Create plots and graphs for your Machine Learning projects.
Project description
Plots and graphs
Visualizations of Machine Learning Metrics quick and simple. Save your time.
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
Calibration Curve | Classification Report | Confusion Matrix |
ROC Curve (AUROC) with bootstrapping | Precision-Recall Curve | y_score histogram |
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
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for plotsandgraphs-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f3b8cdc1665fd16f1c66f3be4b42a14d76494b1793139c5041e6fc3e162f4a8 |
|
MD5 | faaa8a100452bfd7f010740598033954 |
|
BLAKE2b-256 | 194259f7591f0eea83bb542affdcecc9353322d73d67ef7f6abc0fe96628dabd |