def test(data): y = data["fraudulent"] X = data.drop(['fraudulent'], axis=1) split_point = int(0.8 * len(y)) X_train = X.iloc[:split_point] X_test = X.iloc[split_point:] y_train = y.iloc[:split_point] y_test = y.iloc[split_point:] clf = my_model() clf.fit(X_train, y_train) predictions = clf.predict(X_test) eval = my_evaluation(predictions, y_test) f1 = eval.f1(target=1) return f1
def obj_func2(predictions, actuals, pred_proba=None): # One objectives: higher f1 score eval = my_evaluation(predictions, actuals, pred_proba) return [eval.f1()]
def obj_func1(predictions, actuals, pred_proba=None): # Two objectives: higher recall and higher precision eval = my_evaluation(predictions, actuals, pred_proba) return [eval.recall(), eval.precision()]