Learn R Programming

Ecume (version 0.9.2)

classifier_test: 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"),
  ...
)

Value

A list containing the following components:

  • statistic the value of the test statistic.

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

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.

References

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

Examples

Run this code
 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)

Run the code above in your browser using DataLab