energy {SBCK} | R Documentation |
Energy distance
Description
Compute Energy distance between two dataset or SparseHist X and Y
Usage
energy(X, Y, p = 2, metric = "euclidean")
Arguments
X |
[matrix or SparseHist] If matrix, dim = ( nrow = n_samples, ncol = n_features) |
Y |
[matrix or SparseHist] If matrix, dim = ( nrow = n_samples, ncol = n_features) |
p |
[float] power of energy distance, default is 2. |
metric |
[str or function] metric for pairwise distance, default is "euclidean", see SBCK::pairwise_distances |
Value
[float] value of distance
Examples
X = base::cbind( stats::rnorm(2000) , stats::rnorm(2000) )
Y = base::cbind( stats::rnorm(2000,mean=10) , stats::rnorm(2000) )
bw = base::c(0.1,0.1)
muX = SBCK::SparseHist( X , bw )
muY = SBCK::SparseHist( Y , bw )
## The four are equals
w2 = SBCK::energy(X,Y)
w2 = SBCK::energy(muX,Y)
w2 = SBCK::energy(X,muY)
w2 = SBCK::energy(muX,muY)
[Package SBCK version 1.0.0 Index]