Skip to main content

Create plots and graphs for your Machine Learning projects.

Project description

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:

  • binary classification
  • multi-class classification (coming soon)
  • regression (coming soon)

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

Overview of graphs and plots

  • binary classifier

    • Accuracy
    • Calibration Curve
    • Classification Report
    • Confusion Matrix
    • ROC curve (AUROC)
    • y_score histogram
  • multi-class classifier

  • regression

  • comparing distributions

    • raincloud plot

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.

  • Python Graph Gallery - A great collection of graphs. First look at their gallery, then check out their 'BEST' collection for inspiration.
  • Scientific Visualization Book - Definitely check out the first part for essential tips for good graphs. And then deep dive further to improve your visualization game.
  • CHARTIO - A must read on how to choose colors and color palettes.

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

  • DALL-E 3 created the project logo on 17th October 2023. Prompt used: Illustration of a stylized graph with colorful lines and bars, representing data visualization, suitable for a project logo named 'plots and graphs'.

  • The Scientific colour maps in the plotsandgraphs/cmaps folder (Crameri 2018) are used in this library to prevent visual distortion of the data and exclusion of readers with colour-vision deficiencies (Crameri et al., 2020).

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!

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

plotsandgraphs-0.1.4.tar.gz (34.6 kB view hashes)

Uploaded Source

Built Distribution

plotsandgraphs-0.1.4-py3-none-any.whl (32.1 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