View source: R/sampleBuilding.R
formatLabelSample | R Documentation |
Format labels for unsupervised classification and add cleaned observations as 'Noise'.
formatLabelSample(
label,
data.sample,
new.labels = TRUE,
use.sampling = FALSE,
noise.cluster = "Noise"
)
label |
vector of labels. |
data.sample |
sample object. |
new.labels |
boolean: if TRUE (default), new names are given for each cluster (beginning by 'Cluster'). |
use.sampling |
boolean: if TRUE (not default), data.sample$sampling is used to generalize label from sampling set to the whole set. |
noise.cluster |
character name of the cluster "noise". |
formatLabelSample formats labels for unsupervised classification and adds cleaned observations as 'Noise'
new.labels formatted labels.
dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2),
matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf <- tempfile()
write.table(dat, tf, sep=",", dec=".")
x <- importSample(file.features=tf)
res <- KmeansQuick(x$features$initial$x, K=3)
new.labels <- formatLabelSample(res$cluster, x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.