joshuawe / plots_and_graphs

Visualize Machine Learning Metrics
https://pypi.org/project/plotsandgraphs/
GNU General Public License v3.0
3 stars 0 forks source link
classification data-science machine-learning matplotlib performance-metrics performance-visualization plot python regression visualizer

Plots and Graphs

Plots and graphs

Visualizations of Machine Learning Metrics quick and simple. Save your time.

GitHub commits GitHub contributors GitHub issues GPLv3 license Open Source Love png2

Every Machine Learning project requires the evaluation of the algorithm's performance. Many metrics are task specific (classification, regression, ...) but are used again and again and have to be plotted again and again. Plotsandgraphs makes it easier for you to visualize these metrics by providing a library with tidy and clear graphs for the most common metrics. It serves as a wrapper for the popular matplotlib package to create figures. This also allows users to apply custom changes, if necessary.

Plotsandgraphs is model- and framework-agnostic. This means that plotsandgraphs only needs the algorithm's results to perform analysis and visualization and not the actual model itself. In the case of a binary classifier only the true labels as well as the predicted probabilities are required as input. Instead of spending time in visualizing results for each metric, plotsandgraphs can calculate and visualize all classification metrics with a single line of code.

Plotsandgraphs provides analysis and visualization for the following problem types:

Furthermore, this library presents other useful visualizations, such as comparing distributions.

Overview of graphs and plots

Gallery

Your Image Your Image Your Image
Calibration Curve Classification Report Confusion Matrix
Your Image Your Image Your Image
ROC Curve (AUROC) with bootstrapping Precision-Recall Curve y_score histogram
Your Image
Histogram (y_scores) ROC curves (AUROC) with bootstrapping

Other resources

Why create everything from scratch, if some things already exist? Here are some helpful resources that can improve your visualization skills.

Install

Install the package via pip.

pip install plotsandgraphs

Alternatively install the package from git directly.

git clone https://github.com/joshuawe/plots_and_graphs
cd plots_and_graphs
pip install -e .

Usage

Get all classification metrics with ONE line of code. Here, for a binary classifier:

import plotsandgraphs as pandg
# ...
pandg.pipeline.binary_classifier(y_true, y_score)

Or with some more configs:

configs = {
  'roc': {'n_bootstraps': 10000},
  'pr': {'figsize': (8,10)}
}
pandg.pipeline.binary_classifier(y_true, y_score, save_fig_path='results/metrics', file_type='png', plot_kwargs=configs)

For multiclass classification:

# with multiclass data y_true (one-hot encoded) and y_score
pandg.pipeline.multiclass_classifier(y_true, y_score)

Requirements

Show all requirements

Contributors

Contributors

Reference

Of course we are happy to be mentioned in any way, if our repository has helped you. You can also share this repository with your friends and collegues to make their lives easier. Cheers!