40 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

2025-01-12 00:52:51 +08:00
R Under development (unstable) (2019-04-05 r76323) -- "Unsuffered Consequences"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> ## allow backticks in rpart.matrix: see
> ## https://stat.ethz.ch/pipermail/r-help/2012-May/314081.html
>
> set.seed(10)
> library(rpart)
> Iris <- iris
> names(Iris) <- sub(".", " ", names(iris), fixed=TRUE)
> rpart(Species ~ `Sepal Length`, data = Iris)
n= 150
node), split, n, loss, yval, (yprob)
* denotes terminal node
1) root 150 100 setosa (0.33333333 0.33333333 0.33333333)
2) Sepal Length< 5.45 52 7 setosa (0.86538462 0.11538462 0.01923077) *
3) Sepal Length>=5.45 98 49 virginica (0.05102041 0.44897959 0.50000000)
6) Sepal Length< 6.15 43 15 versicolor (0.11627907 0.65116279 0.23255814) *
7) Sepal Length>=6.15 55 16 virginica (0.00000000 0.29090909 0.70909091) *
>
> proc.time()
user system elapsed
0.105 0.017 0.116