Learn R Programming

daltoolbox (version 1.2.747)

smoothing_cluster: Smoothing by clustering (k-means)

Description

Quantize a numeric vector into n levels using k‑means on the values and replace each value by its cluster mean (vector quantization).

Usage

smoothing_cluster(n)

Value

returns an object of class smoothing_cluster

Arguments

n

number of bins

References

MacQueen, J. (1967). Some Methods for classification and Analysis of Multivariate Observations.

Examples

Run this code
data(iris)
obj <- smoothing_cluster(n = 2)
obj <- fit(obj, iris$Sepal.Length)
sl.bi <- transform(obj, iris$Sepal.Length)
table(sl.bi)
obj$interval

entro <- evaluate(obj, as.factor(names(sl.bi)), iris$Species)
entro$entropy

Run the code above in your browser using DataLab