View source: R/metrics.manhattan.R
manhattan | R Documentation |
Compute Manhattan distance between two dataset or SparseHist X and Y
manhattan(X, Y)
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) |
[float] value of distance
X = base::cbind( stats::rnorm(2000) , stats::rnorm(2000) )
Y = base::cbind( stats::rnorm(2000,mean=2) , stats::rnorm(2000) )
bw = base::c(0.1,0.1)
muX = SBCK::SparseHist( X , bw )
muY = SBCK::SparseHist( Y , bw )
## The four are equals
d = SBCK::manhattan( X , Y )
d = SBCK::manhattan(muX , Y )
d = SBCK::manhattan( X , muY )
d = SBCK::manhattan(muX , muY )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.