Giter Site home page Giter Site logo

thieu1995 / permetrics Goto Github PK

View Code? Open in Web Editor NEW
62.0 4.0 17.0 2.41 MB

Artificial intelligence (AI, ML, DL) performance metrics implemented in Python

Home Page: https://permetrics.readthedocs.io/en/latest/

License: GNU General Public License v3.0

Python 96.73% TeX 3.27%
coefficient-of-determination rmse mae performance-metrics symmetric-mean-absolute-percentage nash-sutcliffe-efficiency willmott-index relative-error regression-methods classification-report

permetrics's Introduction

PERMETRICS


GitHub release Wheel PyPI version PyPI - Python Version PyPI - Status PyPI - Downloads Downloads Tests & Publishes to PyPI GitHub Release Date Documentation Status Chat GitHub contributors GitTutorial DOI JOSS License: GPL v3

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:

    @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:

$ 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

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

permetrics's People

Contributors

dependabot[bot] avatar galessiorob avatar n3uraln3twork avatar thieu1995 avatar thieupu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

permetrics's Issues

Collaboration Guidelines

Instructions for Collaboration:

  • Remove scikit-learn dependency
  • In order to minimize size and maximize speed of library
  • Rename the Internal.py and External.py files to:
  • from permetrics.clustering import InternalMetric
  • from permetrics.clustering import ExternalMetric
  • Add the necessary files to the setup.py file
  • scipy
  • numpy (is already included)
  • Create a new branch called 1.4.0 and put your work there

  • Allow for different naming conventions when calling various metrics:
    image

  • Creation and Formatting of Python docstrings:
    image

[BUG]: Relative Absolute Error

Description of the bug

Is there an error in the formula of Relative Absolute Error?

Steps To Reproduce

20240314192734

Additional Information

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.