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.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

Project details


Download files

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

Files for mlplot, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size mlplot-0.0.3-py3-none-any.whl (28.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mlplot-0.0.3.tar.gz (11.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page