Builds a model according to the One Rule (OneR) machine learning classification algorithm.
dataframe, which contains the data. When
formula interface for the
character string specifying how ties are treated, see 'Details'; can be abbreviated.
All numerical data is automatically converted into five categorical bins of equal length. Instances with missing values are removed.
This is done by internally calling the default version of
bin before starting the OneR algorithm.
To finetune this behaviour data preprocessing with the
optbin functions should be performed.
If data contains unused factor levels (e.g. due to subsetting) these are ignored and a warning is given.
When there is more than one attribute with best performance either the first (from left to right) is being chosen (method
the one with the lowest p-value of a chi-squared test (method
Returns an object of class "OneR". Internally this is a list consisting of the function call with the specified arguments, the names of the target and feature variables, a list of the rules, the number of correctly classified and total instances and the contingency table of the best predictor vs. the target variable.
Holger von Jouanne-Diedrich
1 2 3 4 5 6 7 8 9 10 11 12 13 14
data <- optbin(iris) model <- OneR(data, verbose = TRUE) summary(model) plot(model) prediction <- predict(model, data) eval_model(prediction, data) ## The same with the formula interface: data <- optbin(iris) model <- OneR(formula = Species ~., data = data, verbose = TRUE) summary(model) plot(model) prediction <- predict(model, data) eval_model(prediction, data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.