Skip to main content

No project description provided

Project description

CircleCI

mlplot

Machine learning evaluation plots using matplotlib and sklearn.

Install

pip install mlplot

ML Plot runs with python 3.5 and above! (using format strings and type annotations)

Contributing

Create a PR!

Plots

Work was inspired by sklearn model evaluation.

Classification

ROC with AUC number

from mlplot.model_evaluation import ClassifierEvaluation
eval = ClassifierEvaluation(y_true, y_pred, class_names, model_name)
eval.roc_curve()

ROC plot

Calibration

from mlplot.model_evaluation import ClassifierEvaluation
eval = ClassifierEvaluation(y_true, y_pred, class_names, model_name)
eval.calibration()

calibration plot

Precision-Recall

from mlplot.model_evaluation import ClassifierEvaluation
eval = ClassifierEvaluation(y_true, y_pred, class_names, model_name)
eval.precision_recall(x_axis='recall')
eval.precision_recall(x_axis='thresold')

precision recall curve plot

precision recall threshold plot

Distribution

from mlplot.model_evaluation import ClassifierEvaluation
eval = ClassifierEvaluation(y_true, y_pred, class_names, model_name)
eval.distribution()

distribution plot

Confusion Matrix

from mlplot.model_evaluation import ClassifierEvaluation
eval = ClassifierEvaluation(y_true, y_pred, class_names, model_name)
eval.confusion_matrix(threshold=0.5)

confusion matrix

Classification Report

from mlplot.model_evaluation import ClassifierEvaluation
eval = ClassifierEvaluation(y_true, y_pred, class_names, model_name)
eval.report_table()

classification report

Regression

  • Full report
    • Mean sqr error
    • Mean abs error
    • Target mean, std
    • R2
  • Residual plot
  • Scatter plot
  • Histogram of regressor

Library Cleanup

  • Try in a notebook
  • Logging
  • Default matplotlib setup
  • Multi-model comparison
  • Report to generate multiple plots at once

Development

Publish to pypi

python setup.py sdist bdist_wheel
twine upload --repository-url https://upload.pypi.org/legacy/ dist/*

Design

Basic interface thoughts

from mlplot.model_evaluation import ClassifierEvaluation
from mlplot.model_evaluation import RegressorEvaluation
from mlplot.model_evaluation import MultiClassifierEvaluation
from mlplot.model_evaluation import MultiRegressorEvaluation
from mlplot.model_evaluation import ModelComparison
from mlplot.feature_evaluation import *

eval = ClassifierEvaluation(y_true, y_pred)
ax = eval.roc_curve()
auc = eval.auc_score()
f1_score = eval.f1_score()
ax = eval.confusion_matrix(threshold=0.7)
  • ModelEvaluation base class
  • ClassifierEvaluation class
    • take in y_true, y_pred, class names, model_name
  • RegressorEvaluation class
  • MultiClassifierEvaluation class
  • ModelComparison
    • takes in two evaluations of the same type

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlplot-0.0.1.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

mlplot-0.0.1-py3-none-any.whl (16.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page