1 / 4

Árvore de Decisão

Árvore de Decisão. > x<-read.csv('Local onde está/casas.csv') > library(rpart) > arvore<-rpart(classifica ~ local + idade + estado+ tipo,data=x). > arvore n= 100 node), split, n, loss, yval, (yprob) * denotes terminal node 1) root 100 63 medio (0.19 0.24 0.11 0.37 0.09)

mab
Download Presentation

Árvore de Decisão

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Árvore de Decisão • > x<-read.csv('Local onde está/casas.csv') • > library(rpart) • > arvore<-rpart(classifica ~ local + idade + estado+ tipo,data=x)

  2. > arvore • n= 100 • node), split, n, loss, yval, (yprob) • * denotes terminal node • 1) root 100 63 medio (0.19 0.24 0.11 0.37 0.09) • 2) estado=Mbom 23 13 Mbom (0.3 0.087 0.43 0.17 0) • 4) local=bom,mau,Mmau 14 7 bom (0.5 0.14 0.14 0.21 0) * • 5) local=Mbom,medio 9 1 Mbom (0 0 0.89 0.11 0) * • Plot(arvore)

  3. >previsao<-predict(arvore,x) • bom mau Mbom medio Mmau • 1 0.00000000 0.5714286 0.00000000 0.1428571 0.2857143 • 2 0.04761905 0.2380952 0.00000000 0.5714286 0.1428571 • 3 0.04761905 0.2380952 0.00000000 0.5714286 0.1428571 • > previsao<-predict(arvore,x,type='class') • [1] mau medio medio bom medio medio medio

  4. Matriz de Confusão • > table(x$classifica,previsao) • previsao • bom mau Mbom medio Mmau • bom 15 0 0 4 0 • mau 2 12 0 10 0 • Mbom 3 0 8 0 0 • medio 7 3 1 26 0 • Mmau 0 6 0 3 0

More Related