Map > Data Science > Predicting the Future > Modeling > Classification > OneR


OneR, short for "One Rule", is a simple, yet accurate, classification algorithm that generates one rule for each predictor in the data, then selects the rule with the smallest total error as its "one rule".  To create a rule for a predictor, we construct a frequency table for each predictor against the target. It has been shown that OneR produces rules only slightly less accurate than state-of-the-art classification algorithms while producing rules that are simple for humans to interpret.
OneR Algorithm
For each predictor,
     For each value of that predictor, make a rule as follows;
           Count how often each value of target (class) appears
           Find the most frequent class
           Make the rule assign that class to this value of the predictor
     Calculate the total error of the rules of each predictor
Choose the predictor with the smallest total error.
Finding the best predictor with the smallest total error using OneR algorithm based on related frequency tables.

The best predictor is:

Predictors Contribution

Simply, the total error calculated from the frequency tables is the measure of each predictor contribution. A low total error means a higher contribution to the predictability of the model.


Model Evaluation

The following confusion matrix shows significant predictability power. OneR does not generate score or probability, which means evaluation charts (Gain, Lift, K-S and ROC) are not applicable.


Confusion Matrix Play Golf  
Yes No
OneR Yes 7 2

Positive Predictive Value

No 2 3

Negative Predictive Value

  Sensitivity Specificity

Accuracy = 0.71

0.78 0.60
Exercise OneR Interactive
INVENT!Try to invent a new OneR algorithm by using ANOVA and Chi2 test.