-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
50 lines (30 loc) · 1.32 KB
/
README.Rmd
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
output: github_document
---
<!-- badges: start -->
[![R-CMD-check](https://github.com/AnthonyEbert/EasyMMD/workflows/R-CMD-check/badge.svg)](https://github.com/AnthonyEbert/EasyMMD/actions)
[![codecov](https://codecov.io/gh/AnthonyEbert/EasyMMD/branch/master/graph/badge.svg)](https://codecov.io/gh/AnthonyEbert/EasyMMD)
<!-- badges: end -->
<!-- README.md is generated from README.Rmd. Please edit that file -->
# EasyMMD
Gretton et al. (2007) introduced Maximum Mean Discrepancy (MMD). EasyMMD in an R package which provides a simple (hopefully!) and computationally efficient way to compute the MMD between two datasets.
## Installation
You can install EasyMMD from github with:
```{r gh-installation, eval = FALSE}
devtools::install_github("AnthonyEbert/EasyMMD")
```
## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
library(EasyMMD)
n <- 1e3
x <- rnorm(n)
y <- rnorm(n, 5)
MMD(y,x)
# For faster computation, precompute part of the MMD for the observed data y
y_kmmd <- kmmd(y)
MMD(y,x, y_kmmd)
microbenchmark::microbenchmark(MMD(y,x), MMD(y,x, y_kmmd), times = 10)
```
## References
Gretton, A., Borgwardt, K. M., Rasch, M., Schölkopf, B., & Smola, A. J. (2007). A kernel method for the two-sample-problem. In Advances in neural information processing systems (pp. 513-520).