https://github.com/thieu1995/permetrics
Artificial intelligence (AI, ML, DL) performance metrics implemented in Python
https://github.com/thieu1995/permetrics
classification classification-report clustering-evaluation coefficient-of-determination deviation-of-runoff-volume evaluation-metrics kling-gupta-efficiency mae nash-sutcliffe-efficiency performance-metrics regression regression-methods relative-error rmse symmetric-mean-absolute-percentage willmott-index
Last synced: 6 months ago
JSON representation
Artificial intelligence (AI, ML, DL) performance metrics implemented in Python
- Host: GitHub
- URL: https://github.com/thieu1995/permetrics
- Owner: thieu1995
- License: gpl-3.0
- Created: 2020-07-18T08:47:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T22:00:38.000Z (about 1 year ago)
- Last Synced: 2025-03-31T14:11:15.321Z (7 months ago)
- Topics: classification, classification-report, clustering-evaluation, coefficient-of-determination, deviation-of-runoff-volume, evaluation-metrics, kling-gupta-efficiency, mae, nash-sutcliffe-efficiency, performance-metrics, regression, regression-methods, relative-error, rmse, symmetric-mean-absolute-percentage, willmott-index
- Language: Python
- Homepage: https://permetrics.readthedocs.io/en/latest/
- Size: 2.36 MB
- Stars: 73
- Watchers: 3
- Forks: 18
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
![]()
---
[](https://github.com/thieu1995/permetrics/releases)
[](https://pypi.python.org/pypi/permetrics)
[](https://badge.fury.io/py/permetrics)



[](https://pepy.tech/project/permetrics)
[](https://github.com/thieu1995/permetrics/actions/workflows/publish-package.yaml)

[](https://permetrics.readthedocs.io/en/latest/?badge=latest)
[](https://t.me/+fRVCJGuGJg1mNDg1)

[](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
[](https://zenodo.org/badge/latestdoi/280617738)
[](https://doi.org/10.21105/joss.06143)
[](https://www.gnu.org/licenses/gpl-3.0)PerMetrics is a python library for performance metrics of machine learning models. We aim to implement all
performance metrics for problems such as regression, classification, clustering, ... problems. Helping users in all
field access metrics as fast as possible. The number of available metrics include **111 (47 regression metrics, 20 classification metrics, 44 clustering
metrics)**# Citation Request
Please include these citations if you plan to use this library:
- LaTeX:
```bibtex
@article{Thieu_PerMetrics_A_Framework_2024,
author = {Thieu, Nguyen Van},
doi = {10.21105/joss.06143},
journal = {Journal of Open Source Software},
month = mar,
number = {95},
pages = {6143},
title = {{PerMetrics: A Framework of Performance Metrics for Machine Learning Models}},
url = {https://joss.theoj.org/papers/10.21105/joss.06143},
volume = {9},
year = {2024}
}
```- APA:
Thieu, N. V. (2024). PerMetrics: A Framework of Performance Metrics for Machine Learning Models. Journal of Open Source Software, 9(95), 6143. https://doi.org/10.21105/joss.06143
# Installation
Install the [current PyPI release](https://pypi.python.org/pypi/permetrics):
```sh
$ pip install permetrics
```After installation, you can import Permetrics as any other Python module:
```sh
$ python
>>> import permetrics
>>> permetrics.__version__
```# Example
Below is the most efficient and effective way to use this library compared to other libraries.
The example below returns the values of metrics such as root mean squared error, mean absolute error...```python
from permetrics import RegressionMetricy_true = [3, -0.5, 2, 7]
y_pred = [2.5, 0.0, 2, 8]evaluator = RegressionMetric(y_true, y_pred)
results = evaluator.get_metrics_by_list_names(["RMSE", "MAE", "MAPE", "R2", "NSE", "KGE"])
print(results["RMSE"])
print(results["KGE"])
```In case your y_true and y_pred data have multiple columns, and you want to return multiple outputs, something that other libraries cannot do, you can do it in Permetrics as follows:
```python
import numpy as np
from permetrics import RegressionMetricy_true = np.array([[0.5, 1], [-1, 1], [7, -6]])
y_pred = np.array([[0, 2], [-1, 2], [8, -5]])evaluator = RegressionMetric(y_true, y_pred)
## The 1st way
results = evaluator.get_metrics_by_dict({
"RMSE": {"multi_output": "raw_values"},
"MAE": {"multi_output": "raw_values"},
"MAPE": {"multi_output": "raw_values"},
})## The 2nd way
results = evaluator.get_metrics_by_list_names(
list_metric_names=["RMSE", "MAE", "MAPE", "R2", "NSE", "KGE"],
list_paras=[{"multi_output": "raw_values"},] * 6
)## The 3rd way
result01 = evaluator.RMSE(multi_output="raw_values")
result02 = evaluator.MAE(multi_output="raw_values")
```The more complicated cases in the folder: [examples](/examples). You can also read the [documentation](https://permetrics.readthedocs.io/)
for more detailed installation instructions, explanations, and examples.# Contributing
There are lots of ways how you can contribute to Permetrics's development, and you are welcome to join in! For example,
you can report problems or make feature requests on the [issues](/issues) pages. To facilitate contributions,
please check for the guidelines in the [CONTRIBUTING.md](/CONTRIBUTING.md) file.# Official channels
* [Official source code repository](https://github.com/thieu1995/permetrics)
* [Official document](https://permetrics.readthedocs.io/)
* [Download releases](https://pypi.org/project/permetrics/)
* [Issue tracker](https://github.com/thieu1995/permetrics/issues)
* [Notable changes log](/ChangeLog.md)
* [Official discussion group](https://t.me/+fRVCJGuGJg1mNDg1)# Note
* **Currently, there is a huge misunderstanding among frameworks around the world about the notation of R, R2, and R^2.**
* Please read the file [R-R2-Rsquared.docx](.github/assets/R-R2-Rsquared.docx) to understand the differences between them and why there is such confusion.* **My recommendation is to denote the Coefficient of Determination as COD or R2, while the squared Pearson's
Correlation Coefficient should be denoted as R^2 or RSQ (as in Excel software).**---
Developed by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=Permetrics_QUESTIONS) @ 2023