View source: R/trans_smoothing_cluster.R
| smoothing_cluster | R Documentation |
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.
smoothing_cluster(class_label, n)
class_label |
name of the class attribute |
n |
number of bins |
returns an object of class smoothing_cluster
Han, J., Kamber, M., Pei, J. (2011). Data Mining: Concepts and Techniques. (Discretization)
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.