Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save llSourcell/0827e4d8cb8b562521a59cb3aed5963e to your computer and use it in GitHub Desktop.
import pandas
from sklearn.tree import LogisticRegressionClassifier
#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 = LogisticRegressionClassifier.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