I called svm and predict three times with the same data and got three
differing predictions:

> library(e1071)
Lade nötiges Paket: class
> data(Glass, package = "mlbench")
> index <- 1:nrow(Glass)
> testindex <- sample(index, trunc(length(index)/5))
> testset <- Glass[testindex, ]
> trainset <- Glass[-testindex, ]
> model <-
svm(datatrain,classestrain,type="C-classification",kernel="radial",cost=1,class.weights=Wts,probability=TRUE)
> pred_new.test <- predict(model,datatest,probability = TRUE)
> table.test <- table(pred_new.test,t(classestest))
> table.test
             
pred_new.test  1  2  3  5  6  7
            1 12  3  1  0  0  0
            2  1 15  0  0  0  0
            3  0  0  0  0  0  0
            5  0  0  0  1  0  0
            6  0  0  0  0  1  0
            7  0  1  0  1  0  6
> model <-
svm(datatrain,classestrain,type="C-classification",kernel="radial",cost=1,class.weights=Wts,probability=TRUE)
> pred_new.test <- predict(model,datatest,probability = TRUE)
> table.test <- table(pred_new.test,t(classestest))
> table.test
             
pred_new.test  1  2  3  5  6  7
            1 12  3  1  0  0  0
            2  1 14  0  0  0  0
            3  0  0  0  0  0  0
            5  0  0  0  1  0  0
            6  0  1  0  0  1  0
            7  0  1  0  1  0  6
> model <-
svm(datatrain,classestrain,type="C-classification",kernel="radial",cost=1,class.weights=Wts,probability=TRUE)
> pred_new.test <- predict(model,datatest,probability = TRUE)
> table.test <- table(pred_new.test,t(classestest))
> table.test
             
pred_new.test  1  2  3  5  6  7
            1 12  3  1  0  0  0
            2  1 13  0  0  0  0
            3  0  0  0  0  0  0
            5  0  0  0  1  0  0
            6  0  1  0  0  1  0
            7  0  2  0  1  0  6

Is this a feature or a bug?

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to