Learn R Programming

RoughSets (version 1.3-8)

RI.LEM2Rules.RST: Rule induction using the LEM2 algorithm

Description

An implementation of LEM2 (Learning from Examples Module, version 2) for induction of decision rules, originally proposed by J.W. Grzymala-Busse.

Usage

RI.LEM2Rules.RST(decision.table)

Value

An object of a class "RuleSetRST". For details see RI.indiscernibilityBasedRules.RST.

Arguments

decision.table

an object inheriting from the "DecisionTable" class, which represents a decision system. See SF.asDecisionTable.

Author

Andrzej Janusz

References

J.W. Grzymala-Busse, "A New Version of the Rule Induction System LERS", Fundamenta Informaticae, 31, p. 27 - 39 (1997).

See Also

predict.RuleSetFRST, RI.indiscernibilityBasedRules.RST, RI.CN2Rules.RST, RI.AQRules.RST.

Examples

Run this code
###########################################################
## Example
##############################################################
data(RoughSetData)
wine.data <- RoughSetData$wine.dt
set.seed(13)
wine.data <- wine.data[sample(nrow(wine.data)),]

## Split the data into a training set and a test set,
## 60% for training and 40% for testing:
idx <- round(0.6 * nrow(wine.data))
wine.tra <-SF.asDecisionTable(wine.data[1:idx,],
                              decision.attr = 14,
                              indx.nominal = 14)
wine.tst <- SF.asDecisionTable(wine.data[(idx+1):nrow(wine.data), -ncol(wine.data)])

true.classes <- wine.data[(idx+1):nrow(wine.data), ncol(wine.data)]

## discretization:
cut.values <- D.discretization.RST(wine.tra,
                                   type.method = "local.discernibility",
                                   maxNOfCuts = 1)
data.tra <- SF.applyDecTable(wine.tra, cut.values)
data.tst <- SF.applyDecTable(wine.tst, cut.values)

## rule induction from the training set:
rules <- RI.LEM2Rules.RST(data.tra)
rules

## predicitons for the test set:
pred.vals <- predict(rules, data.tst)

## checking the accuracy of predictions:
mean(pred.vals == true.classes)

Run the code above in your browser using DataLab