fusetools.ml_tools.Viz

class fusetools.ml_tools.Viz[source]

Bases: object

Functions for visualizing results from machine learning tasks.

Methods

show_clf_perf

Prints a confusion matrix of an estimator’s binary classification performance.

show_clf_perf_features

Creates a plot of given ScikitLearn estimator Accuracies (Y Axis) by number of features in model (X Axis).

show_model_results

Prints the Accuracy, AUC and Metrics Classification report for an estimator.

classmethod show_clf_perf(width, height, y_test, y_pred, y_score)[source]

Prints a confusion matrix of an estimator’s binary classification performance.

Parameters
  • width – Plot width.

  • height – Plot height.

  • y_test – Output labels for the test dataset.

  • y_pred – Output predictions labels for the test dataset.

  • y_score – Probabilities of certainty for output prediction labels.

Returns

Confusion matrix of an estimator’s binary classification performance.

classmethod show_clf_perf_features(width, height, df, title, model_list, df_max_stats)[source]

Creates a plot of given ScikitLearn estimator Accuracies (Y Axis) by number of features in model (X Axis).

Parameters
  • width – Plot width.

  • height – Plot height.

  • df – Pandas DataFrame with cumulatively trained combined feature names, coefficients, absolute coefficients in order of trained together.

  • title – Plot title.

  • model_list – List of ScikitLearn estimators to iterate through and plot cumulative performance for.

  • df_max_stats – Pandas DataFrame of estimator names, max accuracy achieved and number of features for fitted estimator. Used for plot annotation.

Returns

Plot of given ScikitLearn estimator Accuracies (Y Axis) by number of features in model (X Axis).

classmethod show_model_results(estimator, y_test, y_pred, y_score)[source]

Prints the Accuracy, AUC and Metrics Classification report for an estimator.

Parameters
  • estimator – A trained estimator.

  • y_test – Output labels for the test dataset.

  • y_pred – Output predictions labels for the test dataset.

  • y_score – Probabilities of certainty for output prediction labels.

Returns

Accuracy, AUC and Metrics Classification report for an estimator.