library(rattle)
## Rattle: A free graphical interface for data mining with R.
## Version 4.1.0 Copyright (c) 2006-2015 Togaware Pty Ltd.
## Type 'rattle()' to shake, rattle, and roll your data.
library(party)
## Loading required package: grid
## Loading required package: mvtnorm
## Loading required package: modeltools
## Loading required package: stats4
## Loading required package: strucchange
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
## Loading required package: sandwich
data(iris)
model=ctree(Species~.,data = iris)
plot(model)
table(predict(model),iris$Species)
##
## setosa versicolor virginica
## setosa 50 0 0
## versicolor 0 49 5
## virginica 0 1 45
library(rpart)
model2=rpart(Species~.,data = iris)
fancyRpartPlot(model2)

library(randomForest)
## randomForest 4.6-12
## Type rfNews() to see new features/changes/bug fixes.
model3=randomForest(Species~.,data = iris)
table(predict(model3),iris$Species)
##
## setosa versicolor virginica
## setosa 50 0 0
## versicolor 0 47 4
## virginica 0 3 46
Like this:
Like Loading...
Related