Displaying 2 results from an estimated 2 matches for "acc_predict_tree".
2010 Mar 24
0
how to solve error in precict( ) while using with rpart?
...rk.
sample code is given for reference.
> acc_model<-rpart(V1~V2+V3+V4+V5+V6+V7+V8, data=accEx.train)
> plotcp(acc_model)
>
acc_find_cp<-(acc_model$cptable)[,"CP"][which.min(acc_model$cptable[,"xerror"])]
> acc_prune_model<-prune(acc_model,acc_find_cp)
> acc_predict_tree<-predict(acc_prune_model,newdata=accEx.test,
type="class")
Error in predict.rpart(acc_prune_model, newdata = accEx.test, type =
"class") :
Invalid prediction for rpart object
#conf.mat
#function(true, new)
{
t <- table(true, new)
s <- sum(t)
acc <- round((sum(diag...
2010 Mar 24
0
R-help ordinal regression
...> > acc_model<-rpart(V1~V2+V3+V4+V5+V6+V7+V8,
> data=accEx.train)
> > plotcp(acc_model)
> >
> acc_find_cp<-(acc_model$cptable)[,"CP"][which.min(acc_model$cptable[,"xerror"])]
> > acc_prune_model<-prune(acc_model,acc_find_cp)
> >
> acc_predict_tree<-predict(acc_prune_model,newdata=accEx.test,
> type="class")
> Error in predict.rpart(acc_prune_model, newdata =
> accEx.test, type =
> "class") :
> ? Invalid prediction for rpart object
>
> #conf.mat
> #function(true, new)
> {
> t <- table(t...