smoothing_cluster: Smoothing by clustering (k-means)

View source: R/trans_smoothing_cluster.R

smoothing_clusterR Documentation

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)

Arguments

n

number of bins

Value

returns an object of class smoothing_cluster

References

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

Examples

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

daltoolbox documentation built on Nov. 5, 2025, 7:09 p.m.