Displaying 1 result from an estimated 1 matches for "classestrain".
Did you mean:
classesbctrain
2011 Feb 23
0
svm(e1071) and scaling of weights
...ode.
> library(e1071)
> data(Glass, package = "mlbench")
> index <- 1:nrow(Glass)
> testindex <- sample(index, trunc(length(index)/5))
> testset <- Glass[testindex, ]
> trainset <- Glass[-testindex, ]
> datatrain <- subset(trainset,select=-Type)
> classestrain <- subset(trainset,select=Type)
> Wts <- 1.0/table(Glass$Type);
> model <-
svm(datatrain,classestrain,type="C-classification",kernel="radial",cost=100,class.weights=Wts)
> datatest = subset(testset,select=-Type)
> classestest <- subset(testset,select=T...