Displaying 2 results from an estimated 2 matches for "species_test".
2010 Nov 23
5
cross validation using e1071:SVM
...ted to make a function to Generate cross-validation indices using pls:
cvsegments method.
#####################################################################
Code (at the end) Is working fine but sometime caret:confusionMatrix gives
following error:
stat_result<- confusionMatrix(pred_true1,species_test)
Error in confusionMatrix.default(pred_true1, species_test) :
The data and reference factors must have the same number of levels
My data: total number=260
Class = 6
#####################################
Sorry if I missed some previous discussion about this problem.
It would be nice if anyone...
2011 Jan 24
5
Train error:: subscript out of bonds
...pt out
of bonds? error. I don?t understand why
Any help would be great
thanks
#######
for (i in 1:10)
{
fit1<-NULL;
x<-NULL;
x<-which(number==i)
trainset<-d[-x,]
testset<-d[x,]
train1<-trainset[,-ncol(trainset)]
train1<-train1[,-(1)]
test_t<-testset[,-ncol(testset)]
species_test<-as.factor(testset[,ncol(testset)])
test_t<-test_t[,-(1)]
####
#CARET::TRAIN
####
fit1<-train(train1,as.factor(trainset[,ncol(trainset)]),"svmpoly",trControl
= trainControl((method = "cv"),10,verboseIter = F),tuneLength=3)
pred<-predict(fit1,test_t)
t_train[...