Skip to content

Instantly share code, notes, and snippets.

@vallantin
Created October 19, 2018 19:04
Show Gist options
  • Save vallantin/4749efdf956e917893b564bc1d812258 to your computer and use it in GitHub Desktop.
Save vallantin/4749efdf956e917893b564bc1d812258 to your computer and use it in GitHub Desktop.
# Fit and predict
pipeline.fit(X_train, y_train)
y_pred = pipeline.predict(X_test)
# Evaluate
print('Accuracy score:', accuracy_score(y_test, y_pred))
print("-"*80)
print('Confusion matrix\n')
conmat = np.array(confusion_matrix(y_test, y_pred, labels=[1,0]))
confusion = pd.DataFrame(conmat, index=['Actual +', 'Actual -'],
columns=['Predicted +','Predicted -'])
print(confusion)
print("-"*80)
print('Classification report')
print(classification_report(y_test, y_pred, target_names=['+','-']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment