Fraud Detection in Python
Charlotte Werger
Data Scientist
Ensemble methods:
from sklearn.ensemble import VotingClassifier
clf1 = LogisticRegression(random_state=1) clf2 = RandomForestClassifier(random_state=1) clf3 = GaussianNB()
ensemble_model = VotingClassifier(estimators=[('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='hard')
ensemble_model.fit(X_train, y_train) ensemble_model.predict(X_test)
VotingClassifier(estimators=[('lr', clf1), ('rf', clf2), ('gnb', clf3)], voting='soft', weights=[2,1,1])
Fraud Detection in Python