Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mayer79/metricsweighted
R package for weighted model metrics
https://github.com/mayer79/metricsweighted
machine-learning metrics performance r r-package rstats statistics
Last synced: 5 days ago
JSON representation
R package for weighted model metrics
- Host: GitHub
- URL: https://github.com/mayer79/metricsweighted
- Owner: mayer79
- License: gpl-2.0
- Created: 2019-07-20T18:48:17.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-07-30T11:56:58.000Z (3 months ago)
- Last Synced: 2024-10-04T12:56:53.131Z (about 1 month ago)
- Topics: machine-learning, metrics, performance, r, r-package, rstats, statistics
- Language: R
- Homepage: https://mayer79.github.io/MetricsWeighted/
- Size: 2.73 MB
- Stars: 12
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![R-CMD-check](https://github.com/mayer79/MetricsWeighted/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mayer79/MetricsWeighted/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/mayer79/MetricsWeighted/graph/badge.svg)](https://app.codecov.io/gh/mayer79/MetricsWeighted?branch=main)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/MetricsWeighted)](https://cran.r-project.org/package=MetricsWeighted)[![](https://cranlogs.r-pkg.org/badges/MetricsWeighted)](https://cran.r-project.org/package=MetricsWeighted)
[![](https://cranlogs.r-pkg.org/badges/grand-total/MetricsWeighted?color=orange)](https://cran.r-project.org/package=MetricsWeighted)## Overview
{MetricsWeighted} provides weighted and unweighted versions of metrics and performance measures for machine learning.
## Installation
```r
# From CRAN
install.packages("MetricsWeighted")# Development version
devtools::install_github("mayer79/MetricsWeighted")
```## Usage
There are two ways to apply the package. We will go through them in the following examples. Please have a look at the vignette on CRAN for further information and examples.
### Example 1: Standard interface
``` r
library(MetricsWeighted)y <- 1:10
pred <- c(2:10, 14)rmse(y, pred) # 1.58
rmse(y, pred, w = 1:10) # 1.93r_squared(y, pred) # 0.70
r_squared(y, pred, deviance_function = deviance_gamma) # 0.78```
### Example 2: data.frame interface
Useful, e.g., in a {dplyr} chain.
``` r
dat <- data.frame(y = y, pred = pred)performance(dat, actual = "y", predicted = "pred")
> metric value
> rmse 1.581139performance(
dat,
actual = "y",
predicted = "pred",
metrics = list(rmse = rmse, `R-squared` = r_squared)
)> metric value
> rmse 1.5811388
> R-squared 0.6969697
```Check out the vignette for more applications.