Displaying 2 results from an estimated 2 matches for "svmdata".
Did you mean:
vmdata
2010 May 14
4
Categorical Predictors for SVM (e1071)
...-rnorm(500)
#Categorical Predictor 1, with 5 levels
x3<-as.factor(rep(c(1,2,3,4,5),c(50,150,130,70,100)))
#Catgegorical Predictor 2, with 3 levels
x4<-as.factor(rep(c("R","B","G"),c(100,200,200)))
#Response
y<-rep(c(-1,1),c(275,225))
class<-as.factor(y)
svmdata<-cbind(class,x1,x2,x3,x4)
mod1<-svm(class~.,data=svmdata,type="C-classification")
OR
should each factor be coded as an indicator variable? E.g. for categorical
predictor 2, since there're 3 levels, we code:
(R,R,B,G,G) = ( (1,0,0),(1,0,0),(0,1,0),(0,0,1),(0,0,1) )
There are...
2009 May 11
1
Problems to run SVM regression with e1071
...gamma: 0.001
Number of Support Vectors: 209
I know that it is wrong because when I do prediction appear levels.
I'm working with normalized data [0,1] (249 points) . I don't have idea what it is wrong.
Somebody can help me?
h_aspire
dados=read.table("svmdata.txt",header=TRUE)
index=1:nrow(d)
test=d[210:249,]
train=d[1:209,]
require(e1071)
tuneobj = tune.svm(st ~ ., data = train, gamma = 10^(-6:-3), cost = 10^(1:3summary(tuneobj)
svm.m1 <- svm(st ~ ., data = train, cost = 1000, gamma = 1e-03)
svm.pred <- predict(svm.m1, test)
[[a...