metricsreport


Namemetricsreport JSON
Version 2024.5.15 PyPI version JSON
download
home_pagehttps://github.com/Alex-Lekov/metricsreport
SummaryGenerating reports on metrics for Machine Learning models
upload_time2024-05-15 20:46:28
maintainerNone
docs_urlNone
authorAlex Lekov
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements contourpy cycler fonttools importlib-resources joblib kiwisolver matplotlib numpy packaging pandas pillow pyparsing python-dateutil pytz scikit-learn scipy seaborn six threadpoolctl tzdata zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Metrics Report

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/metricsreport) 
![PyPI](https://img.shields.io/pypi/v/metricsreport) 
[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-2ba2d9.svg)](https://t.me/automlalex) 
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE) 

-------------

MetricsReport is a Python package that generates classification and regression metrics report for machine learning models.


<img width=600 src="./exemples/metricsrepor_html.gif" alt="sample">

## Features
- AutoDetect the type of task
- Save report in .html and .md format
- Has several plotting functions


## Installation

You can install MetricsReport using pip:

```bash
pip install metricsreport
```

## Usage

```python
from metricsreport import MetricsReport  

# sample classification data 
y_true = [1, 0, 0, 1, 0, 1, 0, 1] 
y_pred = [0.8, 0.3, 0.1, 0.9, 0.4, 0.7, 0.2, 0.6]  

# generate report 
report = MetricsReport(y_true, y_pred, threshold=0.5)  

# print all metrics 
print(report.metrics)  

# plot ROC curve 
report.plot_roc_curve()

# saved MetricsReport (html) in folder: report_metrics
report.save_report()
```

More examples in the folder ./examples:


### Constructor

```python
MetricsReport(y_true, y_pred, threshold: float = 0.5)
```

*   `y_true` : list
    *   A list of true target values.
*   `y_pred` : list
    *   A list of predicted target values.
*   `threshold` : float
    *   Threshold for generating binary classification metrics. Default is 0.5.


## Plots

following methods can be used to generate plots:

*   `plot_roc_curve()`: Generates a ROC curve plot.
*   `plot_all_count_metrics()`: Generates a count metrics plot.
*   `plot_precision_recall_curve()`: Generates a precision-recall curve plot.
*   `plot_confusion_matrix()`: Generates a confusion matrix plot.
*   `plot_class_distribution()`: Generates a class distribution plot.
*   `plot_class_hist()`: Generates a class histogram plot.
*   `plot_calibration_curve()`: Generates a calibration curve plot.
*   `plot_lift_curve()`: Generates a lift curve plot.
*   `plot_cumulative_gain()`: Generates a cumulative gain curve plot.

### Dependencies

*   numpy
*   pandas
*   matplotlib
*   scikit-learn
*   scikit-plot

### License

This project is licensed under the MIT License.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Alex-Lekov/metricsreport",
    "name": "metricsreport",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Alex Lekov",
    "author_email": "11148364-AlexLekov@users.noreply.gitlab.com",
    "download_url": "https://files.pythonhosted.org/packages/76/a6/bb2eaacd67ad28f93edec25dab983d4e39cbd294851f1e5bf78788fdf8f2/metricsreport-2024.5.15.tar.gz",
    "platform": null,
    "description": "# Metrics Report\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/metricsreport) \n![PyPI](https://img.shields.io/pypi/v/metricsreport) \n[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-2ba2d9.svg)](https://t.me/automlalex) \n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE) \n\n-------------\n\nMetricsReport is a Python package that generates classification and regression metrics report for machine learning models.\n\n\n<img width=600 src=\"./exemples/metricsrepor_html.gif\" alt=\"sample\">\n\n## Features\n- AutoDetect the type of task\n- Save report in .html and .md format\n- Has several plotting functions\n\n\n## Installation\n\nYou can install MetricsReport using pip:\n\n```bash\npip install metricsreport\n```\n\n## Usage\n\n```python\nfrom metricsreport import MetricsReport  \n\n# sample classification data \ny_true = [1, 0, 0, 1, 0, 1, 0, 1] \ny_pred = [0.8, 0.3, 0.1, 0.9, 0.4, 0.7, 0.2, 0.6]  \n\n# generate report \nreport = MetricsReport(y_true, y_pred, threshold=0.5)  \n\n# print all metrics \nprint(report.metrics)  \n\n# plot ROC curve \nreport.plot_roc_curve()\n\n# saved MetricsReport (html) in folder: report_metrics\nreport.save_report()\n```\n\nMore examples in the folder ./examples:\n\n\n### Constructor\n\n```python\nMetricsReport(y_true, y_pred, threshold: float = 0.5)\n```\n\n*   `y_true` : list\n    *   A list of true target values.\n*   `y_pred` : list\n    *   A list of predicted target values.\n*   `threshold` : float\n    *   Threshold for generating binary classification metrics. Default is 0.5.\n\n\n## Plots\n\nfollowing methods can be used to generate plots:\n\n*   `plot_roc_curve()`: Generates a ROC curve plot.\n*   `plot_all_count_metrics()`: Generates a count metrics plot.\n*   `plot_precision_recall_curve()`: Generates a precision-recall curve plot.\n*   `plot_confusion_matrix()`: Generates a confusion matrix plot.\n*   `plot_class_distribution()`: Generates a class distribution plot.\n*   `plot_class_hist()`: Generates a class histogram plot.\n*   `plot_calibration_curve()`: Generates a calibration curve plot.\n*   `plot_lift_curve()`: Generates a lift curve plot.\n*   `plot_cumulative_gain()`: Generates a cumulative gain curve plot.\n\n### Dependencies\n\n*   numpy\n*   pandas\n*   matplotlib\n*   scikit-learn\n*   scikit-plot\n\n### License\n\nThis project is licensed under the MIT License.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Generating reports on metrics for Machine Learning models",
    "version": "2024.5.15",
    "project_urls": {
        "Homepage": "https://github.com/Alex-Lekov/metricsreport",
        "Repository": "https://github.com/Alex-Lekov/metricsreport"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5773f4801ce7645a2dfcbdfdd2e8d3ddd0ff5fca237ae643a95c2d4727694ae7",
                "md5": "946d4ef7c897d985950541f93fab9a41",
                "sha256": "04b00fb2edb17dd3e2edffe87ea32c23f5bb30c3e9739c3e96ff564feaf7cde6"
            },
            "downloads": -1,
            "filename": "metricsreport-2024.5.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "946d4ef7c897d985950541f93fab9a41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 14265,
            "upload_time": "2024-05-15T20:46:26",
            "upload_time_iso_8601": "2024-05-15T20:46:26.986187Z",
            "url": "https://files.pythonhosted.org/packages/57/73/f4801ce7645a2dfcbdfdd2e8d3ddd0ff5fca237ae643a95c2d4727694ae7/metricsreport-2024.5.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "76a6bb2eaacd67ad28f93edec25dab983d4e39cbd294851f1e5bf78788fdf8f2",
                "md5": "aacae0d55327f1fd4489e95c19d05e6f",
                "sha256": "077f7295a23efee1ce147213b4af7a0e040a1ecaeeae57c006207fd2b5a6eade"
            },
            "downloads": -1,
            "filename": "metricsreport-2024.5.15.tar.gz",
            "has_sig": false,
            "md5_digest": "aacae0d55327f1fd4489e95c19d05e6f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 14030,
            "upload_time": "2024-05-15T20:46:28",
            "upload_time_iso_8601": "2024-05-15T20:46:28.894318Z",
            "url": "https://files.pythonhosted.org/packages/76/a6/bb2eaacd67ad28f93edec25dab983d4e39cbd294851f1e5bf78788fdf8f2/metricsreport-2024.5.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-15 20:46:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Alex-Lekov",
    "github_project": "metricsreport",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "contourpy",
            "specs": [
                [
                    "==",
                    "1.2.1"
                ]
            ]
        },
        {
            "name": "cycler",
            "specs": [
                [
                    "==",
                    "0.12.1"
                ]
            ]
        },
        {
            "name": "fonttools",
            "specs": [
                [
                    "==",
                    "4.51.0"
                ]
            ]
        },
        {
            "name": "importlib-resources",
            "specs": [
                [
                    "==",
                    "6.4.0"
                ]
            ]
        },
        {
            "name": "joblib",
            "specs": [
                [
                    "==",
                    "1.4.2"
                ]
            ]
        },
        {
            "name": "kiwisolver",
            "specs": [
                [
                    "==",
                    "1.4.5"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "==",
                    "3.8.4"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.26.4"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "2.2.2"
                ]
            ]
        },
        {
            "name": "pillow",
            "specs": [
                [
                    "==",
                    "10.3.0"
                ]
            ]
        },
        {
            "name": "pyparsing",
            "specs": [
                [
                    "==",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "python-dateutil",
            "specs": [
                [
                    "==",
                    "2.9.0.post0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    "==",
                    "2024.1"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    "==",
                    "1.4.2"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    "==",
                    "1.13.0"
                ]
            ]
        },
        {
            "name": "seaborn",
            "specs": [
                [
                    "==",
                    "0.13.2"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "threadpoolctl",
            "specs": [
                [
                    "==",
                    "3.5.0"
                ]
            ]
        },
        {
            "name": "tzdata",
            "specs": [
                [
                    "==",
                    "2024.1"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.18.1"
                ]
            ]
        }
    ],
    "lcname": "metricsreport"
}
        
Elapsed time: 1.19405s