tweak: Calcurate suggention for each inputs based on prediction

Description Usage Arguments Value Examples

View source: R/tweak.R

Description

Calcurate suggention for each inputs based on prediction

Usage

1
tweak(esrules, forest, newdata, label.from, label.to, .dopar = TRUE)

Arguments

esrules

an object returned by set.eSatisfactory().

forest

an object of ensemble trees to be parsed. See randomForest or xgboost.

newdata

a data.frame or matrix. test data to be predicted and to be suggested. newdata must have the same structure of train data.

label.from

a character. Predicted class label that user wants to change.

label.to

a character. Class label that user wants to be changed from label.from.

.dopar

logical. If .dopar = TRUE, suggestion for each instance will be calculated in parallel

Value

a list of

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
X <- iris[, 1:(ncol(iris)-1)]
scaled.X <- scale(X)
true.y <- iris[, ncol(iris)]

rf.iris <- randomForest(X, true.y, ntree=30)
rules.rf <- getRules(rf.iris, ktree = 20)
es.rf <- set.eSatisfactory(forest.rf, ntree = 30, epsiron = 0.3, resample = TRUE)
tweaked <- tweak(es.rf, newdata= scaled.X, label.from = "spam", label.to = "nonspam",
                 .dopar = TRUE)

## End(Not run)

katokohaku/featureTweakR documentation built on May 17, 2019, 11:17 p.m.