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: “"mdlp" |
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 arules::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:
arules::discretize()
, arules::discretizeDF()
.
Details about the available supervised discretization methods from discretization: discretization::mdlp, discretization::caim, discretization::cacc, discretization::ameva, discretization::chi2, discretization::chiM, discretization::extendChi2, discretization::modChi2.
Other preparation:
CBA_ruleset()
,
mineCARs()
,
prepareTransactions()
,
transactions2DF()
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.