# HPLBmatrix: Pairwise Total Variation Distance Lower Bound Matrix for the... In HPLB: High-Probability Lower Bounds for the Total Variance Distance

## Description

Pairwise Total Variation Distance Lower Bound Matrix for the Multi-Class Setting

## Usage

 ```1 2 3 4 5 6 7 8``` ```HPLBmatrix( labels, ordering.array, alpha = 0.05, computation.type = "non-optimized", seed = 0, ... ) ```

## Arguments

 `labels` a numeric vector value. The labels of the classes, should be encoded in [0,nclass-1]. `ordering.array` a numeric array of size (nclass, nclass, nobs) such that the value (i,j,k) represents a propensity of being of class j instead of i for observation k. `alpha` a numeric value. The type-I error level. `computation.type` a character value. For the moment only "non-optimized" (default) available. `seed` an integer value. The seed for reproducility. `...` additional parameters to be passed to the HPLB function.

## Value

a numeric matrix of size (nclass, nclass) giving the matrix of pairwise total variation lower bounds.

## Author(s)

Loris Michel, Jeffrey Naef

## References

L. Michel, J. Naef and N. Meinshausen (2020). High-Probability Lower Bounds for the Total Variation Distance

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28``` ``` # iris example require(HPLB) require(ranger) # training a multi-class classifier on iris and getting tv lower bounds between classes data("iris") ind.train <- sample(1:nrow(iris), size = nrow(iris)/2, replace = FALSE) rf <- ranger(Species~., data = iris[ind.train, ], probability = TRUE) preds <- predict(rf, iris[-ind.train,])\$predictions # creating the ordering array based on prediction differences ar <- array(dim = c(3, 3, nrow(preds))) for (i in 1:3) { for (j in 1:3) { ar[i,j,] <- preds[,j] - preds[,i] } } # encoding the class response y <- factor(iris\$Species) levels(y) <- c(0,1,2) y <- as.numeric(y)-1 # getting the lower bound matrix tvhat.iris <- HPLBmatrix(labels = y[-ind.train], ordering.array = ar) tvhat.iris ```

HPLB documentation built on July 1, 2020, 7:10 p.m.