plotsandgraphs


Nameplotsandgraphs JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/joshuawe/plots_and_graphs
SummaryCreate plots and graphs for your Machine Learning projects.
upload_time2023-12-28 11:28:31
maintainer
docs_urlNone
authorJoshua Wendland and Fabian Krüger
requires_python
licenseGNU General Public License v3.0
keywords plots graphs machine learning data science data visualization data analysis matplotlib
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
 <img width="150px" src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/logo_plots_and_graphs.png?raw=true" align="center" alt="Plots and Graphs" />
 <h2 align="center">Plots and graphs</h2>
 <p align="center">Visualizations of Machine Learning Metrics quick and simple. Save your time.</p>
</p>

<p align="center">
  <a href="https://GitHub.com/joshuawe/plots_and_graphs/commits">
    <img src="https://badgen.net/github/commits/joshuawe/plots_and_graphs" alt="GitHub commits">
  </a>
  <a href="https://GitHub.com/Naereen/badges/graphs/contributors/">
    <img src="https://img.shields.io/github/contributors/joshuawe/plots_and_graphs.svg" alt="GitHub contributors">
  </a>
  <a href="https://GitHub.com/joshuawe/plots_and_graphs/issues/">
    <img src="https://badgen.net/github/issues/joshuawe/plots_and_graphs/" alt="GitHub issues">
  </a>
  <a href="https://github.com/joshuawe/plots_and_graphs/blob/main/LICENSE">
    <img src="https://img.shields.io/badge/License-GPLv3-blue.svg" alt="GPLv3 license">
  </a>
  <a href="https://github.com/ellerbrock/open-source-badges/">
    <img src="https://badges.frapsoft.com/os/v2/open-source.png?v=103" alt="Open Source Love png2">
  </a>
</p>


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

| <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/calibration_plot.png?raw=true" width="300" alt="Your Image"> | <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/classification_report.png?raw=true" width="300" alt="Your Image"> | <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/confusion_matrix.png?raw=true" width="300" alt="Your Image"> |
|:--------------------------------------------------:|:----------------------------------------------------------:|:-------------------------------------------------:|
|                    Calibration Curve               |                  Classification Report                     |                 Confusion Matrix                 |

| <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/roc_curve_bootstrap.png?raw=true" width="300" alt="Your Image">        | <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/pr_curve.png?raw=true" width="300" alt="Your Image">        | <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/y_prob_histogram.png?raw=true" width="300" alt="Your Image">  |
|:--------------------------------------------------:|:----------------------------------------------------------:|:-------------------------------------------------:|
|                    ROC Curve (AUROC) with bootstrapping             |                 Precision-Recall Curve                          |                  y_score histogram                                 |


| <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/multiclass/histogram_4_classes.png?raw=true" width="300" alt="Your Image">        |  <img src="https://github.com/joshuawe/plots_and_graphs/blob/main/images/multiclass/roc_curves_multiclass.png?raw=true" width="300" alt=""> | <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" width="300" height="300" alt=""> |
|:--------------------------------------------------:|:-------------------------------------------------:| :-------------------------------------------------:|
|                    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](https://python-graph-gallery.com) - A great collection of graphs. First look at their gallery, then check out their '[BEST](https://python-graph-gallery.com/best-python-chart-examples/)' collection for inspiration.
+ [Scientific Visualization Book](https://github.com/rougier/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](https://chartio.com/learn/charts/how-to-choose-colors-data-visualization/) - A must read on how to choose colors and color palettes.


# Install

Install the package via pip.
```bash
pip install plotsandgraphs
```

Alternatively install the package from git directly.
```bash
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:

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

Or with some more configs:
```Python
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:

```Python
# 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](https://contrib.rocks/image?repo=joshuawe/plots_and_graphs)

+ [DALL-E 3](https://openai.com/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](https://www.fabiocrameri.ch/colourmaps/) in the `plotsandgraphs/cmaps` folder [(Crameri 2018)](https://doi.org/10.5281/zenodo.1243862) are used in this library to prevent visual distortion of the data and exclusion of readers with colour-vision deficiencies [(Crameri et al., 2020)](https://www.nature.com/articles/s41467-020-19160-7).


# 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!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/joshuawe/plots_and_graphs",
    "name": "plotsandgraphs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "plots,graphs,machine learning,data science,data visualization,data analysis,matplotlib",
    "author": "Joshua Wendland and Fabian Kr\u00fcger",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b6/be/1308c7e843ea744de8163689a4734f5afa41ed079010945a25b81820fee7/plotsandgraphs-0.1.4.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n <img width=\"150px\" src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/logo_plots_and_graphs.png?raw=true\" align=\"center\" alt=\"Plots and Graphs\" />\n <h2 align=\"center\">Plots and graphs</h2>\n <p align=\"center\">Visualizations of Machine Learning Metrics quick and simple. Save your time.</p>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://GitHub.com/joshuawe/plots_and_graphs/commits\">\n    <img src=\"https://badgen.net/github/commits/joshuawe/plots_and_graphs\" alt=\"GitHub commits\">\n  </a>\n  <a href=\"https://GitHub.com/Naereen/badges/graphs/contributors/\">\n    <img src=\"https://img.shields.io/github/contributors/joshuawe/plots_and_graphs.svg\" alt=\"GitHub contributors\">\n  </a>\n  <a href=\"https://GitHub.com/joshuawe/plots_and_graphs/issues/\">\n    <img src=\"https://badgen.net/github/issues/joshuawe/plots_and_graphs/\" alt=\"GitHub issues\">\n  </a>\n  <a href=\"https://github.com/joshuawe/plots_and_graphs/blob/main/LICENSE\">\n    <img src=\"https://img.shields.io/badge/License-GPLv3-blue.svg\" alt=\"GPLv3 license\">\n  </a>\n  <a href=\"https://github.com/ellerbrock/open-source-badges/\">\n    <img src=\"https://badges.frapsoft.com/os/v2/open-source.png?v=103\" alt=\"Open Source Love png2\">\n  </a>\n</p>\n\n\nEvery 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. \n\n**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. \n\n**Plotsandgraphs** provides analysis and visualization for the following problem types:\n- **binary classification**\n- *multi-class classification (coming soon)*\n- *regression (coming soon)*\n\nFurthermore, this library presents other useful visualizations, such as **comparing distributions**.\n\n\n# Overview of graphs and plots\n\n- **binary classifier**\n    - Accuracy\n    - Calibration Curve\n    - Classification Report\n    - Confusion Matrix\n    - ROC curve (AUROC)\n    - y_score histogram\n\n- *multi-class classifier*\n\n- *regression*\n\n\n- **comparing distributions**\n    - raincloud plot\n\n# Gallery\n\n| <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/calibration_plot.png?raw=true\" width=\"300\" alt=\"Your Image\"> | <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/classification_report.png?raw=true\" width=\"300\" alt=\"Your Image\"> | <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/confusion_matrix.png?raw=true\" width=\"300\" alt=\"Your Image\"> |\n|:--------------------------------------------------:|:----------------------------------------------------------:|:-------------------------------------------------:|\n|                    Calibration Curve               |                  Classification Report                     |                 Confusion Matrix                 |\n\n| <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/roc_curve_bootstrap.png?raw=true\" width=\"300\" alt=\"Your Image\">        | <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/pr_curve.png?raw=true\" width=\"300\" alt=\"Your Image\">        | <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/y_prob_histogram.png?raw=true\" width=\"300\" alt=\"Your Image\">  |\n|:--------------------------------------------------:|:----------------------------------------------------------:|:-------------------------------------------------:|\n|                    ROC Curve (AUROC) with bootstrapping             |                 Precision-Recall Curve                          |                  y_score histogram                                 |\n\n\n| <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/multiclass/histogram_4_classes.png?raw=true\" width=\"300\" alt=\"Your Image\">        |  <img src=\"https://github.com/joshuawe/plots_and_graphs/blob/main/images/multiclass/roc_curves_multiclass.png?raw=true\" width=\"300\" alt=\"\"> | <img src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" width=\"300\" height=\"300\" alt=\"\"> |\n|:--------------------------------------------------:|:-------------------------------------------------:| :-------------------------------------------------:|\n|                    Histogram (y_scores)              |    ROC curves (AUROC) with bootstrapping                                            | |\n\n\n\n# Other resources\n\nWhy create everything from scratch, if some things already exist? Here are some helpful resources that can improve your visualization skills.\n\n+ [Python Graph Gallery](https://python-graph-gallery.com) - A great collection of graphs. First look at their gallery, then check out their '[BEST](https://python-graph-gallery.com/best-python-chart-examples/)' collection for inspiration.\n+ [Scientific Visualization Book](https://github.com/rougier/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.\n+ [CHARTIO](https://chartio.com/learn/charts/how-to-choose-colors-data-visualization/) - A must read on how to choose colors and color palettes.\n\n\n# Install\n\nInstall the package via pip.\n```bash\npip install plotsandgraphs\n```\n\nAlternatively install the package from git directly.\n```bash\ngit clone https://github.com/joshuawe/plots_and_graphs\ncd plots_and_graphs\npip install -e .\n```\n\n# Usage\n\nGet all classification metrics with **ONE** line of code. Here, for a binary classifier:\n\n```python\nimport plotsandgraphs as pandg\n# ...\npandg.pipeline.binary_classifier(y_true, y_score)\n```\n\nOr with some more configs:\n```Python\nconfigs = {\n  'roc': {'n_bootstraps': 10000},\n  'pr': {'figsize': (8,10)}\n}\npandg.pipeline.binary_classifier(y_true, y_score, save_fig_path='results/metrics', file_type='png', plot_kwargs=configs)\n```\n\nFor multiclass classification:\n\n```Python\n# with multiclass data y_true (one-hot encoded) and y_score\npandg.pipeline.multiclass_classifier(y_true, y_score)\n```\n\n# Requirements\n> Show all requirements\n\n\n# Contributors\n\n![Contributors](https://contrib.rocks/image?repo=joshuawe/plots_and_graphs)\n\n+ [DALL-E 3](https://openai.com/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'.*\n\n+ The [Scientific colour maps](https://www.fabiocrameri.ch/colourmaps/) in the `plotsandgraphs/cmaps` folder [(Crameri 2018)](https://doi.org/10.5281/zenodo.1243862) are used in this library to prevent visual distortion of the data and exclusion of readers with colour-vision deficiencies [(Crameri et al., 2020)](https://www.nature.com/articles/s41467-020-19160-7).\n\n\n# Reference\n\nOf course we are happy to be mentioned in any way, if our repository has helped you.\nYou can also share this repository with your friends and collegues to make their lives easier. Cheers!\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3.0",
    "summary": "Create plots and graphs for your Machine Learning projects.",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/joshuawe/plots_and_graphs"
    },
    "split_keywords": [
        "plots",
        "graphs",
        "machine learning",
        "data science",
        "data visualization",
        "data analysis",
        "matplotlib"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "194259f7591f0eea83bb542affdcecc9353322d73d67ef7f6abc0fe96628dabd",
                "md5": "faaa8a100452bfd7f010740598033954",
                "sha256": "5f3b8cdc1665fd16f1c66f3be4b42a14d76494b1793139c5041e6fc3e162f4a8"
            },
            "downloads": -1,
            "filename": "plotsandgraphs-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "faaa8a100452bfd7f010740598033954",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 32060,
            "upload_time": "2023-12-28T11:28:29",
            "upload_time_iso_8601": "2023-12-28T11:28:29.661608Z",
            "url": "https://files.pythonhosted.org/packages/19/42/59f7591f0eea83bb542affdcecc9353322d73d67ef7f6abc0fe96628dabd/plotsandgraphs-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6be1308c7e843ea744de8163689a4734f5afa41ed079010945a25b81820fee7",
                "md5": "db13c6d799166138bdd4750dd59a77c5",
                "sha256": "6b060e8c4495b5e95c8a1a605019957b578bcfeed98522c3838d3c2e6f1eb3fe"
            },
            "downloads": -1,
            "filename": "plotsandgraphs-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "db13c6d799166138bdd4750dd59a77c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 34623,
            "upload_time": "2023-12-28T11:28:31",
            "upload_time_iso_8601": "2023-12-28T11:28:31.255469Z",
            "url": "https://files.pythonhosted.org/packages/b6/be/1308c7e843ea744de8163689a4734f5afa41ed079010945a25b81820fee7/plotsandgraphs-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-28 11:28:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joshuawe",
    "github_project": "plots_and_graphs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "plotsandgraphs"
}
        
Elapsed time: 0.16750s