# Przykład 6.3 options(OutDec=",") library("ElemStatLearn") library("mlbench") library("rpart") library("gbm") library("ipred") # Boston # bagging model<- bagging(medv ~ ., data=Boston, coob=TRUE) print(model) ### bundling data(Boston) bos.bund<-list(list(model=lm,predict=predict)) bos.bund<-list(list(model=svm,predict=predict)) mod.bos<-bagging(medv~ .,data=Boston,comb=bos.bund, control=rpart.control(minsplit=2, xval=0, cp=0)) ypred<-predict(mod.bos,Boston) y<-Boston$medv 1-sum((y-ypred)^2)/(sum((y-mean(y))^2)) rr<-rpart(medv~ .,data=Boston) ypred<-predict(rr,Boston)