formatLabelSample: Labels formatting

View source: R/sampleBuilding.R

formatLabelSampleR Documentation

Labels formatting

Description

Format labels for unsupervised classification and add cleaned observations as 'Noise'.

Usage

formatLabelSample(
  label,
  data.sample,
  new.labels = TRUE,
  use.sampling = FALSE,
  noise.cluster = "Noise"
)

Arguments

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".

Details

formatLabelSample formats labels for unsupervised classification and adds cleaned observations as 'Noise'

Value

new.labels formatted labels.

Examples

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)



RclusTool documentation built on May 29, 2024, 5:23 a.m.