PerMetrics: A Framework of Performance Metrics for Machine Learning Models
Project description
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:
@software{nguyen_van_thieu_2023_8220489,
author = {Nguyen Van Thieu},
title = {PerMetrics: A Framework of Performance Metrics for Machine Learning Models},
month = aug,
year = 2023,
publisher = {Zenodo},
doi = {10.5281/zenodo.3951205},
url = {https://github.com/thieu1995/permetrics}
}
Installation
Install the current PyPI release:
$ pip install permetrics
After installation, you can import Permetrics as any other Python module:
$ 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...
from permetrics import RegressionMetric
y_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:
import numpy as np
from permetrics import RegressionMetric
y_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. You can also read the documentation 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 pages. To facilitate contributions, please check for the guidelines in the CONTRIBUTING.md file.
Official channels
- Official source code repository
- Official document
- Download releases
- Issue tracker
- Notable changes log
- Official discussion group
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 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 @ 2023
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
File details
Details for the file permetrics-2.0.0.tar.gz
.
File metadata
- Download URL: permetrics-2.0.0.tar.gz
- Upload date:
- Size: 56.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7d79d654fa54aa31b293b10bfd22c34c50cd80f0d05b7ca38e295c99b10d53e |
|
MD5 | 425c2cafc9416a895a27ff2433310fb3 |
|
BLAKE2b-256 | c32d3e572d9a08bb79023a56bea7575edba8abbafad73509437c1ffebceabd8f |
File details
Details for the file permetrics-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: permetrics-2.0.0-py3-none-any.whl
- Upload date:
- Size: 52.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7252fff81e2e2dec67ca7db3826f4d6ec65072cfa76b8e41bc534ab53f331e |
|
MD5 | 491e62eaa49db23d265e52463d7a2487 |
|
BLAKE2b-256 | 2603113d55caacf415f9fb29ed3af940592a54b725b62d1f4c3d5297ddf14c10 |