Description Usage Arguments Details Value Author(s) References See Also Examples
Predict cases or probabilities based on OneR model object.
1 2 |
object |
object of class |
newdata |
data frame in which to look for the feature variable with which to predict. |
type |
character string denoting the type of predicted value returned. Default |
... |
further arguments passed to or from other methods. |
newdata
can have the same format as used for building the model but must at least have the feature variable that is used in the OneR rules.
If cases appear that were not present when building the model the predicted case is UNSEEN
or NA
when "type = prob"
.
The default is a factor with the predicted classes, if "type = prob"
a matrix is returned whose columns are the probability of the first, second, etc. class.
Holger von Jouanne-Diedrich
1 2 3 4 5 6 7 | model <- OneR(iris)
prediction <- predict(model, iris[1:4])
eval_model(prediction, iris[5])
## type prob
predict(model, data.frame(Petal.Width = seq(0, 3, 0.5)))
predict(model, data.frame(Petal.Width = seq(0, 3, 0.5)), type = "prob")
|
Confusion matrix (absolute):
Actual
Prediction setosa versicolor virginica Sum
setosa 49 0 0 49
versicolor 1 45 3 49
virginica 0 5 47 52
Sum 50 50 50 150
Confusion matrix (relative):
Actual
Prediction setosa versicolor virginica Sum
setosa 0.33 0.00 0.00 0.33
versicolor 0.01 0.30 0.02 0.33
virginica 0.00 0.03 0.31 0.35
Sum 0.33 0.33 0.33 1.00
Accuracy:
0.94 (141/150)
Error rate:
0.06 (9/150)
Error rate reduction (vs. base rate):
0.91 (p-value < 2.2e-16)
(-Inf,0.0976] (0.0976,0.58] (0.58,1.06] (1.06,1.54] (1.54,2.02]
UNSEEN setosa versicolor versicolor virginica
(2.02,2.5] (2.5, Inf]
virginica UNSEEN
Levels: UNSEEN setosa versicolor virginica
setosa versicolor virginica
(-Inf,0.0976] NA NA NA
(0.0976,0.58] 1.000 0.0000000 0.00000000
(0.58,1.06] 0.125 0.8750000 0.00000000
(1.06,1.54] 0.000 0.9268293 0.07317073
(1.54,2.02] 0.000 0.1724138 0.82758621
(2.02,2.5] 0.000 0.0000000 1.00000000
(2.5, Inf] NA NA NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.