Skip to main content

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.evaluation import ClassificationEvaluation
eval = ClassificationEvaluation(y_true, y_pred, class_names, model_name)
eval.roc_curve()

https://github.com/sbarton272/mlplot/blob/master/tests/output/tests.evaluation.test_classification.test_calibration.png?raw=true ROC plot

Calibration

from mlplot.evaluation import ClassificationEvaluation
eval = ClassificationEvaluation(y_true, y_pred, class_names, model_name)
eval.calibration()

calibration plot

Precision-Recall

from mlplot.evaluation import ClassificationEvaluation
eval = ClassificationEvaluation(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.evaluation import ClassificationEvaluation
eval = ClassificationEvaluation(y_true, y_pred, class_names, model_name)
eval.distribution()

distribution plot

Confusion Matrix

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

confusion matrix

Classification Report

from mlplot.evaluation import ClassificationEvaluation
eval = ClassificationEvaluation(y_true, y_pred, class_names, model_name)
eval.report_table()

classification report

Regression

Scatter Plot

from mlplot.evaluation import RegressionEvaluation
eval = RegressionEvaluation(y_true, y_pred, class_names, model_name)
eval.scatter()

scatter plot

Residuals Plot

from mlplot.evaluation import RegressionEvaluation
eval = RegressionEvaluation(y_true, y_pred, class_names, model_name)
eval.residuals()

scatter plot

Residuals Histogram

from mlplot.evaluation import RegressionEvaluation
eval = RegressionEvaluation(y_true, y_pred, class_names, model_name)
eval.residuals_histogram()

scatter plot

Regression Report

from mlplot.evaluation import RegressionEvaluation
eval = RegressionEvaluation(y_true, y_pred, class_names, model_name)
eval.report_table()

report table

Forecasts

  • TBD

Rankings

  • TBD

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.evaluation import ClassificationEvaluation
from mlplot.evaluation import RegressorEvaluation
from mlplot.evaluation import MultiClassificationEvaluation
from mlplot.evaluation import MultiRegressorEvaluation
from mlplot.evaluation import ModelComparison
from mlplot.feature_evaluation import *

eval = ClassificationEvaluation(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
  • ClassificationEvaluation class
    • take in y_true, y_pred, class names, model_name
  • RegressorEvaluation class
  • MultiClassificationEvaluation class
  • ModelComparison
    • takes in two evaluations of the same type

TODO

  • Fix distribution plot, make lines
  • Add legend with R2 to regression plots
  • Add tests for regression comparison
  • Split apart files for comparison classes
  • Add comparisons to README

Release files for mlplot 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlplot 0.0.3
File Size Uploaded
mlplot-0.0.3.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mlplot 0.0.3
File Interpreter ABI Platform
mlplot-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size:40.3 kB

Release files / mlplot-0.0.3.tar.gz

Download URL mlplot-0.0.3.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9d41f81168f03f3e9f25687fb4a0d345e1161d5379128289d4a04bcbad79044a
BLAKE2b-256 checksum
How to use checksums
daff6315a7cd11ff4cb96a666ebcefe2701da7e9f4289427c5fe9decdf5b98c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.5

Release files / mlplot-0.0.3-py3-none-any.whl

Download URL mlplot-0.0.3-py3-none-any.whl
Size 28.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07a4439386a0a225b861b4eb936f304ee3be694c508dbddd3e681429c1c7bc9c
BLAKE2b-256 checksum
How to use checksums
08c665226d8c191f6915e97929928cf65f070c991e3ed1f5d88a03fe5de1c08c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page