machine learning - R: Tuning SVM parameter - class.weights in {e1071} package -


i wanted training svm classifier package {e1071}. realize class.weight 1 of parameters wanted tune. eg. want test 2 class weights c(25, 50) vs. c(20, 55) wonder if build in tune function job, , if so, how?

here training data:

training.data  =     height0 height1 height2 weight0 weight1 gender class 1     0      1       0       1       0      1       1 2     0      1       0       0       1      0       1 3     0      1       0       0       0      1       1 4     1      0       0       1       0      0       1 5     0      1       0       0       1      0       2 6     0      1       0       0       1      0       2 

and there 2 levels in response variable 'class'

training.data$class =   [1] 1 1 1 1 2 2 levels: 1 2 

i want use function this,

param.obj <- tune(svm, class ~., data = training.data,      ranges = list("1" = c(25, 20), "2" = c(50,55) ),     tunecontrol = tune.control(sampling = "cross", cross = 5) ) 

but don't think correct way it, because if change "2" "3" still works.

param.obj <- tune(svm, class ~., data = training.data,      ranges = list("1" = c(25, 20), "3" = c(50,55) ),     tunecontrol = tune.control(sampling = "cross", cross = 5) ) 

doesn't give me error. googled around cannot seem find proper way... appreciated!

the ranges list named list of parameters , parameter want adjust class.weights. believe ranges line in tune like:

ranges=list (class.weights=list(c("1"=25, "2"=20), c("1"=50, "2"=55)) 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -