library(xts)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(quantmod)
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
install.packages("/Users/maxineharlemon/AIOpt/DMwR2_0.0.2.tar.gz", repos=NULL, type = "source")
library(DMwR2)
set.seed(1234)
data(iris)
ct1<-rpartXse(Species ~., iris)
ct2<-rpartXse(Species ~., iris, se=0)
library(rpart.plot)
## Loading required package: rpart
prp(ct1, type = 0, extra = 101, roundint = FALSE)

set.seed(1234)
rndSample<-sample(1:nrow(iris), 100)
tr<-iris[rndSample,]
ts<- iris[-rndSample,]
ct<-rpartXse(Species ~.,tr,se=0.5)
psi<-predict(ct, ts)
head(psi)
## setosa versicolor virginica
## 1 1 0 0
## 7 1 0 0
## 11 1 0 0
## 12 1 0 0
## 15 1 0 0
## 16 1 0 0
ps2<-predict(ct, ts,type="class")
head(ps2)
## 1 7 11 12 15 16
## setosa setosa setosa setosa setosa setosa
## Levels: setosa versicolor virginica
cm<-table(ps2, ts$Species)
100*(1-sum(diag(cm))/sum(cm))
## [1] 8