1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
> data(iris)
> ind <- sample(2, nrow(iris), replace=TRUE, prob=c(0.7, 0.3))
> trainData <- iris[ind==1,]
> testData <- iris[ind==2,]
> myFormula <- Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width
> iris_ctree <- ctree(myFormula, data=trainData)
> print (iris_ctree)
Conditional inference tree with 3 terminal nodes
Response: Species
Inputs: Sepal.Length, Sepal.Width, Petal.Length, Petal.Width
Number of observations: 102
1) Petal.Length <= 1.9; criterion = 1, statistic = 95.58
2)* weights = 38
1) Petal.Length > 1.9
3) Petal.Width <= 1.6; criterion = 1, statistic = 46.013
4)* weights = 33
3) Petal.Width > 1.6
5)* weights = 31
> plot(iris_ctree) |
Partager