
Steve, 
Thanks a lot for your answer. I haven´t tried to deal with the situation yet, cause I had a field trip. I'll let you know if I can solve my problem with your observation.
Bye,

Juan P. Argañaraz

Lic. en Ecología y Cons. del Ambiente

Instituto de Hidrología de Llanuras

CC 44 (B7300) Azul, Bs. As., Argentina

Tel./Fax: +54-2281-432666

--- El jue 13-may-10, Steve Lianoglou-6 [via R] <ml-node+2215774-1079690811-258456@n4.nabble.com> escribió:

De: Steve Lianoglou-6 [via R] <ml-node+2215774-1079690811-258456@n4.nabble.com>
Asunto: Re: tune svm
Para: "jparga" <argajuan@yahoo.com.ar>
Fecha: jueves, 13 de mayo de 2010, 18:12



Hi,


On Thu, May 13, 2010 at 3:54 PM, jparga <[hidden email]> wrote:

>

> Hello, I hope you can help me!

> I`m trying to tune svm parameters: cost and gamma for a landsat image

> classification, but I get an error and I can't understand it.

> I write this:

>> tune(svm, Class~., data = mdt01bis, ranges = list(gamma = 2^(-15:3), cost

>> = 2^(-5:15)))

> and R gives:

> Error en predict.svm(model, if (!is.null(validation.x)) validation.x else if

> (useFormula) data[-train.ind[[sample]],  :

>  test data does not match model !

>

> The matrix is as follows, with 720 rows and 4 categories in column Class

> B1       B2       B3       B4       B5       B6       Class

>  [1,] "0.0450" "0.0599" "0.1169" "0.1820" "0.3040" "0.2826" "CV"

>  [2,] "0.0481" "0.0630" "0.1222" "0.1854" "0.3040" "0.2891" "CV"

>  [3,] "0.0497" "0.0630" "0.1329" "0.1988" "0.2929" "0.2794" "CV"

>  [4,] "0.0450" "0.0567" "0.1196" "0.1854" "0.2973" "0.2859" "CV"

>

> and the svm:

>> svm(Class~., data=mdt01bis, method="C-classification", kernel="radial",

>> cost=10, gamma=0.1)

> works ok.

> Could you please tell me what is wrong?

I'm not really sure, but the first red flag is that your numbers are

stored as characters (B1, B2, etc. are strings)

Also the formula interface expects a data.frame (an object which can

have mixed column types) and not a matrix (an object that can only

contain one type).


Since one of your columns contains "CV", and you're trying to

horseshoe all of you data into a matrix, perhaps all your numerical

values are being upcast to characters, which is subsequently messing

something up.


-- 

Steve Lianoglou

Graduate Student: Computational Systems Biology

 | Memorial Sloan-Kettering Cancer Center

 | Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact

______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.







View message @ http://r.789695.n4.nabble.com/tune-svm-tp2209804p2215774.html


To unsubscribe from tune svm, click here.







-- 
View this message in context: http://r.789695.n4.nabble.com/tune-svm-tp2209804p2217080.html
Sent from the R help mailing list archive at Nabble.com.

	[[alternative HTML version deleted]]

