View source: R/discretizeDF.supervised.R
discretizeDF.supervised | R Documentation |
This function implements several supervised methods to convert continuous variables into a categorical variables (factor) suitable for association rule mining and building associative classifiers. A whole data.frame is discretized (i.e., all numeric columns are discretized).
discretizeDF.supervised(formula, data, method = "mdlp", dig.lab = 3, ...)
formula |
a formula object to specify the class variable for supervised
discretization and the predictors to be discretized in the form |
data |
a data.frame containing continuous variables to be discretized |
method |
discretization method. Available are: |
dig.lab |
integer; number of digits used to create labels. |
... |
Additional parameters are passed on to the implementation of the chosen discretization method. |
discretizeDF.supervised
only implements supervised discretization.
See discretizeDF
in package arules for unsupervised
discretization.
discretizeDF
returns a discretized data.frame. Discretized
columns have an attribute "discretized:breaks"
indicating the used
breaks or and "discretized:method"
giving the used method.
Michael Hahsler
Unsupervised discretization from arules:
discretize
, discretizeDF
.
Details about the available supervised discretization methods from
discretization: mdlp
,
caim
, cacc
,
ameva
, chi2
,
chiM
,
extendChi2
,
modChi2
.
data("iris") summary(iris) # supervised discretization using Species iris.disc <- discretizeDF.supervised(Species ~ ., iris) summary(iris.disc) attributes(iris.disc$Sepal.Length) # discretize the first few instances of iris using the same breaks as iris.disc discretizeDF(head(iris), methods = iris.disc) # only discretize predictors Sepal.Length and Petal.Length iris.disc2 <- discretizeDF.supervised(Species ~ Sepal.Length + Petal.Length, iris) head(iris.disc2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.