FOIL {arulesCBA} | R Documentation |
Use FOIL to learn a rule set for classification
Description
Build a classifier rule base using FOIL (First Order Inductive Learner), a greedy algorithm that learns rules to distinguish positive from negative examples.
Usage
FOIL(
formula,
data,
max_len = 3,
min_gain = 0.7,
best_k = 5,
disc.method = "mdlp"
)
Arguments
formula |
A symbolic description of the model to be fitted. Has to be
of form |
data |
A data.frame or arules::transactions containing the training data.
Data frames are automatically discretized and converted to transactions with
|
max_len |
maximal length of the LHS of the created rules. |
min_gain |
minimal gain required to expand a rule. |
best_k |
use the average expected accuracy (laplace) of the best k rules per class for prediction. |
disc.method |
Discretization method used to discretize continuous
variables if data is a data.frame (default: |
Details
Implements FOIL (Quinlan and Cameron-Jones, 1995) to learn rules and then use them as a classifier following Xiaoxin and Han (2003).
For each class, we find the positive and negative examples and learn the rules using FOIL. Then the rules for all classes are combined and sorted by Laplace accuracy on the training data.
Following Xiaoxin and Han (2003), we classify new examples by
select all the rules whose bodies are satisfied by the example;
-
from the rules select the best k rules per class (highest expected Laplace accuracy);
average the expected Laplace accuracy per class and choose the class with the highest average.
Value
Returns an object of class CBA representing the trained classifier.
Author(s)
Michael Hahsler
References
Quinlan, J.R., Cameron-Jones, R.M. Induction of logic programs: FOIL and related systems. NGCO 13, 287-312 (1995). doi:10.1007/BF03037228
Yin, Xiaoxin and Jiawei Han. CPAR: Classification based on Predictive Association Rules, SDM, 2003. doi:10.1137/1.9781611972733.40
See Also
Other classifiers:
CBA()
,
CBA_helpers
,
CBA_ruleset()
,
LUCS_KDD_CBA
,
RCAR()
,
RWeka_CBA
Examples
data("iris")
# learn a classifier using automatic default discretization
classifier <- FOIL(Species ~ ., data = iris)
classifier
# inspect the rule base
inspect(classifier$rules)
# make predictions for the first few instances of iris
predict(classifier, head(iris))