Valdas
2011-Jul-24 16:32 UTC
[R] repeated execution of svm(e1071) gives different results, if probability = TRUE is set
Hello, Connoisseurs! Please explain to novices, why svm model gives different results in the loop with the same data? As a result, I can not find the best gamma and cost parameters. Also tune.svm yields results that can not be repeated. How can I avoid this? My sessionInfo: R version 2.11.1 (2010-05-31) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] e1071_1.5-26 class_7.3-2 Here's a simple code example. You can run it a few times. library('e1071') prob <- function() { model <- svm(Species ~ ., data = iris[-1,], probability=TRUE) p <- predict(model, newdata=iris[1,], probability=TRUE) pr <- attr(p, "probabilities") print(pr) return(pr) } cat('FirstCalc==SecondCalc:',all( prob() == prob() ),'\n') Valdas
Apparently Analagous Threads
- [e1071] Inconsistent results when using matrix.csr for svm() - possibly scaling problem
- e1071: using svm with sparse matrices (PR#8527)
- Un-reproductibility of SVM classification with 'e1071' libSVM package
- SVM cross validation in e1071
- rgl keyboard shortcut for translation on Mac?