Skip to content

Instantly share code, notes, and snippets.

@llSourcell
Created April 24, 2018 23:38
Show Gist options
  • Select an option

  • Save llSourcell/b4c8396080143f47cf90da8788b20093 to your computer and use it in GitHub Desktop.

Select an option

Save llSourcell/b4c8396080143f47cf90da8788b20093 to your computer and use it in GitHub Desktop.
import pandas
from sklearn.tree import DecisionTreeClassifier
#Read transaction data
data=pd.read_csv('../input/creditcard.csv')
x_train, x_test, y_train, y_test = train_test_split(data, target, train_size = 0.50)
#train model
model = DecisionTreeClassifier.fit(x_train,y_train)
score = model.score(x_test, y_test)
#print result
print(score)
#test, output fraud/not fraud
model.predict(y_test[3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment