BinCat-class: BinCat class: Binned predictions with categorical bins

Description Usage Details Slots Examples

Description

A predx class for binned probabilistic predictions with categorical bins specified by strings.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
BinCat(x)

is.BinCat(x)

## S4 method for signature 'BinCat'
predx_to_json(x)

## S4 method for signature 'BinCat'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

## S4 method for signature 'BinCat'
transform_predx(x, to_class, ...)

Details

BinCat is flexible as it can be used for any binned predictions. Individual probabilities (prob) must be greater than or equal to 0 and less than or equal to 1 and the vector of probabilities must sum to 1.

In JSON and CSV representations, the bins are named cat and the probabilities are named prob.

Slots

predx

A data.frame with two columns: cat (character) and prob (numeric).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x <- BinCat(data.frame(
  cat = c('a', 'b', 'c'),
  prob = c(0, 0.3, 0.7)
))
x
# create predx dataframe
x_df <- as.predx_df(list(
 location = c('Mercury', 'Venus', 'Earth'),
 target = 'habitability',
 predx = list(x, x)
))

cdcepi/predx documentation built on Dec. 29, 2019, 4:58 p.m.