View source: R/trans_smoothing_quantization.R
| smoothing_quantization | R Documentation |
Quantize a numeric vector into n levels using k‑means on the values and
replace each value by its cluster mean (vector quantization).
smoothing_quantization(n)
n |
number of bins |
returns an object of class smoothing_quantization
MacQueen, J. (1967). Some Methods for classification and Analysis of Multivariate Observations.
data(iris)
obj <- smoothing_quantization(n = 2)
obj <- fit(obj, iris$Sepal.Length)
sl.bi <- transform(obj, iris$Sepal.Length)
table(sl.bi)
obj$interval
bins <- cut(iris$Sepal.Length, unique(obj$interval.adj), FALSE, include.lowest = TRUE)
entro <- evaluate(obj, bins, iris$Species)
entro$entropy
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.