Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bsm/mlmetrics
Common metrics for evaluation of machine learning models
https://github.com/bsm/mlmetrics
classification confusion-matrix golang kappa logloss machine-learning matthews ml online-machine-learning r2 regression
Last synced: 11 days ago
JSON representation
Common metrics for evaluation of machine learning models
- Host: GitHub
- URL: https://github.com/bsm/mlmetrics
- Owner: bsm
- License: apache-2.0
- Created: 2018-10-25T14:24:09.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2021-07-20T08:36:04.000Z (over 3 years ago)
- Last Synced: 2023-08-11T22:51:08.333Z (over 1 year ago)
- Topics: classification, confusion-matrix, golang, kappa, logloss, machine-learning, matthews, ml, online-machine-learning, r2, regression
- Language: Go
- Size: 18.6 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ML metrics
[![GoDoc](https://godoc.org/github.com/bsm/mlmetrics?status.svg)](https://godoc.org/github.com/bsm/mlmetrics)
[![Test](https://github.com/bsm/openmetrics/actions/workflows/test.yml/badge.svg)](https://github.com/bsm/openmetrics/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)Common metrics for evaluation of machine learning models.
Goals:
* Fast!
* Thread-safe
* Support for online evaluation## Supported Metrics
Classification:
* [Accuracy](https://en.wikipedia.org/wiki/Accuracy_and_precision)
* [Confusion Matrix](https://en.wikipedia.org/wiki/Confusion_matrix)
* [F1 Score](https://en.wikipedia.org/wiki/F1_score)
* [Kappa](https://en.wikipedia.org/wiki/Cohen%27s_kappa)
* [Matthews](https://en.wikipedia.org/wiki/Matthews_correlation_coefficient)
* [LogLoss](https://en.wikipedia.org/wiki/Loss_functions_for_classification)
* [Precision](https://en.wikipedia.org/wiki/Information_retrieval#Precision)
* [Sensitivity](https://en.wikipedia.org/wiki/Sensitivity_(test))Regression:
* [Mean Absolute Error](https://en.wikipedia.org/wiki/Mean_absolute_error)
* [Mean Squared Error](https://en.wikipedia.org/wiki/Mean_squared_error)
* [Root Mean Squared Error](https://en.wikipedia.org/wiki/Root-mean-square_deviation)
* [Mean Squared Error](https://en.wikipedia.org/wiki/Root-mean-square_deviation)
* [R²](https://en.wikipedia.org/wiki/Coefficient_of_determination)## Documentation
Documentation and example are available via godoc at http://godoc.org/github.com/bsm/mlmetrics
## Example
```go
package mainimport (
"github.com/bsm/mlmetrics"
)func main() {
yTrue := []int{2, 0, 2, 2, 0, 1}
yPred := []int{0, 0, 2, 2, 0, 2}mat := mlmetrics.NewConfusionMatrix()
for i := range yTrue {
mat.Observe(yTrue[i], yPred[i])
}// print matrix
for i := 0; i < mat.Order(); i++ {
fmt.Println(mat.Row(i))
}// print metrics
fmt.Println()
fmt.Printf("accuracy : %.3f\n", mat.Accuracy())
fmt.Printf("kappa : %.3f\n", mat.Kappa())
fmt.Printf("matthews : %.3f\n", mat.Matthews())}
```