Learn R Programming

daltoolbox (version 1.3.767)

smoothing_cluster: Smoothing by class-aware clustering

Description

Discretize a numeric attribute into n bins by clustering the attribute together with a one-hot representation of the class label, then projecting the clusters back to ordered cut points on the numeric axis.

Usage

smoothing_cluster(class_label, n)

Value

returns an object of class smoothing_cluster

Arguments

class_label

name of the class attribute

n

number of bins

References

Han, J., Kamber, M., Pei, J. (2011). Data Mining: Concepts and Techniques. (Discretization)

Examples

Run this code
data(iris)
cluster_data <- iris[, c("Sepal.Length", "Species")]
obj <- smoothing_cluster("Species", n = 2)
obj <- fit(obj, cluster_data)
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

Run the code above in your browser using DataLab