classifier_test: Classifier k-sample test

View source: R/classifier_test.R

classifier_testR Documentation

Classifier k-sample test

Description

Classifier k-sample test

Usage

classifier_test(
  x,
  y,
  split = 0.7,
  thresh = 0,
  method = "knn",
  control = caret::trainControl(method = "cv"),
  ...
)

Arguments

x

Samples from the first distribution or a list of samples from k distribution

y

Samples from the second distribution. Only used if x is a vector.

split

How to split the data between training and test. Default to .7

thresh

Value to add to the null hypothesis. See details.

method

Which model(s) to use during training. Default to knn.

control

Control parameters when fitting the methods. See trainControl

...

Other parameters passed to train

Details

See Lopez-Paz et .al for more background on those tests.

Value

A list containing the following components:

  • statistic the value of the test statistic.

  • p.value the p-value of the test.

References

Lopez-Paz, D., & Oquab, M. (2016). Revisiting Classifier Two-Sample Tests, 1–15. Retrieved from http://arxiv.org/abs/1610.06545

Examples

 x <- matrix(c(runif(100, 0, 1),
               runif(100, -1, 1)),
             ncol = 2)
 y <- matrix(c(runif(100, 0, 3),
               runif(100, -1, 1)),
             ncol = 2)
 classifier_test(x, y)

Ecume documentation built on May 29, 2024, 5:10 a.m.