smoothing: Smoothing (binning/quantization)

View source: R/trans_smoothing.R

smoothingR Documentation

Smoothing (binning/quantization)

Description

Family of smoothing methods that reduce noise by replacing values with the mean of a bin. Supported strategies include equal‑interval bins, equal‑frequency (quantile) bins, k-means quantization, and class-aware clustering.

Usage

smoothing(n)

Arguments

n

number of bins

Details

The smoothing level is controlled by n (number of bins/levels). The base helper tune() chooses n by locating the elbow (maximum curvature) of the MSE curve across candidates. Concrete subclasses may override that criterion when supervision is required. After fit(), values are mapped to bin means via transform().

Value

returns an object of class smoothing

Examples

data(iris)
obj <- smoothing_inter(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

daltoolbox documentation built on May 14, 2026, 9:06 a.m.