View source: R/nearestNeighbors.R
npdrDistances | R Documentation |
Create m x m distance matrix from m instances and p attributes using different metrics. Used by nearestNeighbors(). Note: Probably best to standardize data before manhattan and euclidean.
npdrDistances(attr.mat, metric = "manhattan", fast.dist = FALSE)
attr.mat |
m x p matrix of m instances and p attributes |
metric |
for distance matrix between instances (default: |
fast.dist |
whether or not distance is computed by faster algorithm in wordspace, default as F |
matrix of m x m (instances x intances) pairwise distances.
train_dat <- case.control.3sets$train
dist.mat <- npdrDistances(
train_dat[, names(train_dat) != "class"],
metric = "manhattan"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.