search for: svmpred

Displaying 7 results from an estimated 7 matches for "svmpred".

2011 Feb 02
2
SVM Prediction and Plot
Hi I'm trying to predict using a model I fitted with SVM. I constructed the model (called Svm) using a training set, and now I want to use a test set (called BankTest) for prediction. The response variable is in the first column of BankTest. > SvmPred = predict(Svm, BankTest[,-1], probability=TRUE) > SvmPredRes = table(Pred = SvmPred, True = BankTest[,1]) I get this error: Error in table(Pred = SvmPred, True = BankTest) : all arguments must have the same length I checked the length of both BankTest[,1] and SvmPredict. > length(SvmPred)...
2011 Feb 22
0
why no "probabilities" from svm.predict?
> library(ROCR) > library(e1071) svmres.prob <- svm(traindx, traindy, probability=TRUE) svmpred.prob <- predict(svmres.prob, testdx, probability = TRUE, decision.values = TRUE, type="prob") > print(length(attr(svmpred.prob, "probabilities"))) [1] 0 > print(attr(svmpred.prob, "probabilities")) NULL > print(attributes(svmpred.prob)$decision.values)...
2011 Feb 21
3
ROC from R-SVM?
*Hi, *Does anyone know how can I show an *ROC curve for R-SVM*? I understand in R-SVM we are not optimizing over SVM cost parameter. Any example ROC for R-SVM code or guidance can be really useful. Thanks, Angel. [[alternative HTML version deleted]]
2013 Apr 14
1
Aggregate function Bagging
...s = NULL, bagControl = bagControl(), ...) bagControl(fit = NULL, predict = NULL, aggregate = NULL, downSample = FALSE) My fit function is: svmFit <- function(x, y, ...) { library(e1071) svm(Score~., data = mydataset) } My predict function is : svmPred <- function(object, x) { predict(object, x)[,1] } However, I don't know how to build the aggregate function. Does anyone know how to develop it? [[alternative HTML version deleted]]
2012 Dec 10
3
splitting dataset based on variable and re-combining
I have a dataset and I wish to use two different models to predict. Both models are SVM. The reason for two different models is based on the sex of the observation. I wish to be able to make predictions and have the results be in the same order as my original dataset. To illustrate I will use iris: # Take Iris and create a dataframe of just two Species, setosa and versicolor, shuffle them
2007 Jan 22
0
Recursive-SVM (R-SVM)
...er) ) { ## record the genes selected in this ladder SelFreq[SelInd, gLevel] <- SelFreq[SelInd, gLevel] +1 ## train SVM model and test error svmres <- svm(xTrain[, SelInd], yTrain, scale=F, type="C-classification", kernel="linear" ) if( CVtype == "LOO" ) { svmpred <- predict(svmres, matrix(xTest[SelInd], nrow=1) ) } else { svmpred <- predict(svmres, xTest[, SelInd] ) } ErrVec[gLevel] <- ErrVec[gLevel] + sum(svmpred != yTest ) ## weight vector W <- t(svmres$coefs*yTrain[svmres$index]) %*% svmres$SV * md[SelInd] rkW <- rank(W) if( gLeve...
2002 Aug 20
0
Re: SVM questions
...). Now, ``libsvm'' actually returns a_i * y_i as i-th coefficiant and the *negative* rho, so in fact uses the formula: Sum(coef_i * K(x_i, n)) - rho i where the training examples (=training data) are labeled {1,-1}. A simplified R function for prediction with linear kernel would be: svmpred <- function (m, newdata, K=crossprod) { ## this guy does the computation: pred.one <- function (x) sign(sum(sapply(1:m$tot.nSV, function (j) K(m$SV[j,], x) * m$coefs[j] ) ) - m$rho ) ## this is just for convenience: if...