classification_report: Build a classification report

View source: R/classification_report.R

classification_reportR Documentation

Build a classification report

Description

Create a table giving precision, recall and F1-scores.

Usage

classification_report(pred, true, exclude = NULL)

cr(pred, true, exclude = NULL)

## S3 method for class 'cr'
print(x, digits = 3, ...)

Arguments

pred

vector of predicted classes.

true

vector of true classes.

exclude

vector of classes to exclude for average metrics computation. They are then marked by a *. This is typically used to exclude dominant classes that skew the average too much.

x

output of classification_report().

digits

number of digits to display for each number in the report.

...

passed to base::print().

Value

A data.frame with global and per class metrics.

Examples

# fit and predict a classifier
res <- mutate(mtcars, cyl=factor(cyl)) %>%
  resample_cv(k=3) %>%
  xgb_fit(resp="cyl", expl=c("mpg", "hp", "qsec"), nrounds=30) %>%
  xgb_predict(fns=NULL)
res
classification_report(res$pred, res$cyl)
classification_report(res$pred, res$cyl, exclude=8)

jiho/joml documentation built on Dec. 6, 2023, 5:50 a.m.