text_plain_output_1.png
from sklearn.metrics import mean_absolute_error

from sklearn.model_selection import train_test_split

from sklearn.tree import DecisionTreeRegressor

import pandas as pd

import pandas as pd
fraud_data_path = '../input/credit_fraud_sytn.csv'
fraud_data = pd.read_csv(fraud_data_path)

fraud_data.columns

y = fraud_data.isFradulent
feature_names = ['Average Amount/transaction/day', 'Transaction_amount', 'isForeignTransaction', 'isHighRiskCountry']
X = fraud_data[feature_names]

from sklearn.tree import DecisionTreeRegressor
fraud_model = DecisionTreeRegressor(random_state=1)
fraud_model.fit(X, y)

from sklearn.metrics import mean_absolute_error
predicted_fraud = fraud_model.predict(X)
mean_absolute_error(y, predicted_fraud)

from sklearn.model_selection import train_test_split
train_X, val_X, train_y, val_y = train_test_split(X, y, random_state=0)
fraud_model = DecisionTreeRegressor()
fraud_model.fit(train_X, train_y)
val_predictions = fraud_model.predict(val_X)
print(mean_absolute_error(val_y, val_predictions))