[R] Error with KNN
Hi all I receive this error message: Error in mymodel$MSE : $ operator is invalid for atomic vectors When I use KNN. This is the code: library(e1071) train <- rbind(iris3[,,1], iris3[,,2], iris3[,,3]) cl <- factor(c(rep("s",50), rep("c",50), rep("v",50))) knn.cv(train, cl, k = 3, prob = TRUE) sqrt(mymodel$MSE) #error message : Error in mymodel$MSE : $ operator is invalid for atomic vectors thanks, Nancy _ Hotmail: Trusted email with powerful SPAM protection. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
Re: [R] Error with KNN
Hi Uwe, Thank you for your email. I need to compute one value indicating to the performance of knn but I dont know anything other than MSE. Can you please tell me how I do that? Many thanks, Nancy > Date: Mon, 22 Feb 2010 17:19:48 +0100 > From: lig...@statistik.tu-dortmund.de > To: nancyada...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] Error with KNN > > > > On 20.02.2010 19:10, Nancy Adam wrote: > > > > > > > > Hi all > > > > I receive this error message: Error in mymodel$MSE : $ operator is invalid > > for atomic vectors > > When I use KNN. > > This is the code: > > > > library(e1071) > > train<- rbind(iris3[,,1], iris3[,,2], iris3[,,3]) > > cl<- factor(c(rep("s",50), rep("c",50), rep("v",50))) > > knn.cv(train, cl, k = 3, prob = TRUE) > > sqrt(mymodel$MSE) > > #error message : Error in mymodel$MSE : $ operator is invalid for atomic > > vectors > > > > There is no component MSE in mymodel. Hence you cannot extract it. > > Uwe Ligges > > > > > > > thanks, > > Nancy > > > > _ > > Hotmail: Trusted email with powerful SPAM protection. > > > > [[alternative HTML version deleted]] > > > > > > > > > > __ > > R-help@r-project.org 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. _ Hotmail: Free, trusted and rich email service. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] read dataset in R language.
Hi, Could you please help me in solving the following error message: Error in `[.data.frame`(mytestdata, fp_temp == 1) : undefined columns selected when I use scan instead on read.table, I reicieve this message: Error in names(ret2) <- rowns : 'names' attribute [172] must be the same length as the vector [152] Many thanks, Nancy _ [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] read dataset in R language.
Hi all, Could you please help me in solving the following error message: Error in `[.data.frame`(mytestdata, fp_temp == 1) : undefined columns selected when I use scan instead on read.table, I reicieve this message: Error in names(ret2) <- rowns : 'names' attribute [172] must be the same length as the vector [152] Many thanks, Nancy _ [[alternative HTML version deleted]] __ R-help@r-project.org 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.
Re: [R] read dataset in R language.
Dear Phil, Thanks for your reply. I tried using: But this message appears: Error in scale(newdata[, object$scaled, drop = FALSE], center = object$x.scale$"scaled:center", : (subscript) logical subscript too long I also changed the separator but did not solve the problem many thanks, Nancy > Date: Tue, 15 Dec 2009 14:05:14 -0800 > From: spec...@stat.berkeley.edu > To: nancyada...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] read dataset in R language. > > Nancy - > The separator in these files is the comma, not the semicolon. > Try > > train = read.csv('trainingset.txt',check.names=FALSE) > test = read.csv('testset.txt',check.names=FALSE) > > - Phil Spector > Statistical Computing Facility > Department of Statistics > UC Berkeley > spec...@stat.berkeley.edu > > > > On Tue, 15 Dec 2009, Nancy Adam wrote: > > > > > > > Hi all,Thanks for your reply. Sorry I did not send sufficient information > > about my problem I attach the two datasets that Im trying to read and > > these are my attempts to read them:1)#train <- > > read.table("trainingset.txt", header=TRUE, sep=";" ,fill=TRUE) #test <- > > read.table("testset.txt", header=TRUE, sep=";" , fill=TRUE)its error > > message is: > > undefined columns selected2)train <- scan("trainingset.txt", sep=";" > > ,fill=TRUE) test <- scan("testset.txt", sep=";" , fill=TRUE) > > > > its error message is: > > 'names' attribute [172] must be the same length as the vector [152] > > > > many thanks, > > Nancy > > _ > > > > _ Keep your friends updatedeven when youre not signed in. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] Read dataset in R language.
Hi all, Thanks for the explanation I got other datasets that are already used with others but I got the same errors: “undefined columns selected” I attach the datasets with this email and this is the command I’m trying: train = read.csv("trainingset.txt",check.names=FALSE) test = read.csv("testset.txt",check.names=FALSE) many thanks, Nancy _ MYCT;MMIN;MMAX;CACH;CHMIN;CHMAX;class 59;4000;12000;32;6;12;81 59;8000;16000;64;12;24;149 26;8000;24000;32;8;16;183 26;8000;32000;64;12;16;275 26;8000;32000;128;24;32;382 116;2000;8000;32;5;28;56 50;2000;32000;24;6;26;182 50;2000;32000;48;26;52;227 50;2000;32000;112;52;104;341 50;4000;32000;112;52;104;360 30;8000;64000;96;12;176;919 30;8000;64000;128;12;176;978 180;262;4000;0;1;3;24 180;512;4000;0;1;3;24 180;262;4000;0;1;3;24 180;512;4000;0;1;3;24 124;1000;8000;0;1;8;37 98;1000;8000;32;2;8;50 125;2000;8000;0;2;14;41 480;512;8000;32;0;0;47 480;1000;4000;0;0;0;25 MYCT;MMIN;MMAX;CACH;CHMIN;CHMAX;class 125;256;6000;256;16;128;199 29;8000;32000;32;8;32;253 29;8000;32000;32;8;32;253 29;8000;32000;32;8;32;253 29;8000;16000;32;8;16;132 26;8000;32000;64;8;32;290 23;16000;32000;64;16;32;381 23;16000;32000;64;16;32;381 23;16000;64000;64;16;32;749 23;32000;64000;128;32;64;1238 400;1000;3000;0;1;2;23 400;512;3500;4;1;6;24 60;2000;8000;65;1;8;70 50;4000;16000;65;1;8;117 350;64;64;0;1;4;15 200;512;16000;0;4;32;64 167;524;2000;8;4;15;23 143;512;5000;0;7;32;29 143;1000;2000;0;5;16;22 110;5000;5000;142;8;64;124 143;1500;6300;0;5;32;35 143;3100;6200;0;5;20;39 143;2300;6200;0;6;64;40 110;3100;6200;0;6;64;45 320;128;6000;0;1;12;28 320;512;2000;4;1;3;21 320;256;6000;0;1;6;28 320;256;3000;4;1;3;22 320;512;5000;4;1;5;28 320;256;5000;4;1;6;27 25;1310;2620;131;12;24;102 25;1310;2620;131;12;24;102 50;2620;10480;30;12;24;74 50;2620;10480;30;12;24;74 56;5240;20970;30;12;24;138 64;5240;20970;30;12;24;136 50;500;2000;8;1;4;23 50;1000;4000;8;1;5;29 50;2000;8000;8;1;5;44 50;1000;4000;8;3;5;30 50;1000;8000;8;3;5;41 50;2000;16000;8;3;5;74 50;2000;16000;8;3;6;74 50;2000;16000;8;3;6;74 133;1000;12000;9;3;12;54 133;1000;8000;9;3;12;41 810;512;512;8;1;1;18 810;1000;5000;0;1;1;28 320;512;8000;4;1;5;36 200;512;8000;8;1;8;38 700;384;8000;0;1;1;34 700;256;2000;0;1;1;19 140;1000;16000;16;1;3;72 200;1000;8000;0;1;2;36 110;1000;4000;16;1;2;30 110;1000;12000;16;1;2;56 220;1000;8000;16;1;2;42 800;256;8000;0;1;4;34 800;256;8000;0;1;4;34 800;256;8000;0;1;4;34 800;256;8000;0;1;4;34 800;256;8000;0;1;4;34 125;512;1000;0;8;20;19 75;2000;8000;64;1;38;75 75;2000;16000;64;1;38;113 75;2000;16000;128;1;38;157 90;256;1000;0;3;10;18 105;256;2000;0;3;10;20 105;1000;4000;0;3;24;28 105;2000;4000;8;3;19;33 75;2000;8000;8;3;24;47 75;3000;8000;8;3;48;54 175;256;2000;0;3;24;20 300;768;3000;0;6;24;23 300;768;3000;6;6;24;25 300;768;12000;6;6;24;52 300;768;4500;0;1;24;27 300;384;12000;6;1;24;50 300;192;768;6;6;24;18 180;768;12000;6;1;31;53 330;1000;3000;0;2;4;23 300;1000;4000;8;3;64;30 300;1000;16000;8;2;112;73 330;1000;2000;0;1;2;20 330;1000;4000;0;3;6;25 140;2000;4000;0;3;6;28 140;2000;4000;0;4;8;29 140;2000;4000;8;1;20;32 140;2000;32000;32;1;20;175 140;2000;8000;32;1;54;57 140;2000;32000;32;1;54;181 140;2000;32000;32;1;54;181 140;2000;4000;8;1;20;32 57;4000;16000;1;6;12;82 57;4000;24000;64;12;16;171 26;16000;32000;64;16;24;361 26;16000;32000;64;8;24;350 26;8000;32000;0;8;24;220 26;8000;16000;0;8;16;113 480;96;512;0;1;1;15 203;1000;2000;0;1;5;21 115;512;6000;16;1;6;35 1100;512;1500;0;1;1;18 1100;768;2000;0;1;1;20 600;768;2000;0;1;1;20 400;2000;4000;0;1;1;28 400;4000;8000;0;1;1;45 900;1000;1000;0;1;2;18 900;512;1000;0;1;2;17 900;1000;4000;4;1;2;26 900;1000;4000;8;1;2;28 900;2000;4000;0;3;6;28 225;2000;4000;8;3;6;31 225;2000;4000;8;3;6;31 180;2000;8000;8;1;6;42 185;2000;16000;16;1;6;76 180;2000;16000;16;1;6;76 225;1000;4000;2;3;6;26 25;2000;12000;8;1;4;59 25;2000;12000;16;3;5;65 17;4000;16000;8;6;12;101 17;4000;16000;32;6;12;116 1500;768;1000;0;0;0;18 1500;768;2000;0;0;0;20 800;768;2000;0;0;0;20 50;2000;4000;0;3;6;30 50;2000;8000;8;3;6;44 50;2000;8000;8;1;6;44 50;2000;16000;24;1;6;82 50;2000;16000;24;1;6;82 50;8000;16000;48;1;10;128 100;1000;8000;0;2;6;37 100;1000;8000;24;2;6;46 100;1000;8000;24;3;6;46 50;2000;16000;12;3;16;80 50;2000;16000;24;6;16;88 50;2000;16000;24;6;16;88 150;512;4000;0;8;128;33 115;2000;8000;16;1;3;46 115;2000;4000;2;1;5;29 92;2000;8000;32;1;6;53 92;2000;8000;32;1;6;53 92;2000;8000;4;1;6;41 75;4000;16000;16;1;6;86 60;4000;16000;32;1;6;95 60;2000;16000;64;5;8;107 60;4000;16000;64;5;8;117 50;4000;16000;64;5;10;119 72;4000;16000;64;8;16;120 72;2000;8000;16;6;8;48 40;8000;16000;32;8;16;126 40;8000;32000;64;8;24;266 35;8000;32000;64;8;24;270 38;16000;32000;128;16;32;426 48;4000;24000;32;8;24;151 38;8000;32000;64;8;24;267 30;16000;32000;256;16;24;603 112;1000;1000;0;1;4;19 84;1000;2000;0;1;6;21 56;1000;4000;0;1;6;26 56;2000;6000;0;1;8;35 56;2000;8000;0;1;8;41 56;4000;8000;0;1;8;47 56;4000;12000;0;1;8;62 56;4000;1
Re: [R] Read dataset in R language.
Hi all, I tried many things to read any dataset but I receive different error messages every time. One new message is: vector size specified is too large Can any one please send any part from any dataset just for testing a regression system and to know where is the problem?? Many thanks, Nancy _ Keep your friends updatedeven when youre not signed in. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] svm regression/classification
Hi everyone, Can anyone please tell whether there is a difference between the code for using svm in regression and code for using svm in classification? This is my code for regression, should I change it to do classification?: train <- read.table("trainingset.txt",sep=";") test <- read.table("testset.txt",sep=";") svmmodelfitness <- function(myformula,mydata,mytestdata) { mymodel <- svm(myformula,data=mydata) mytest <- predict(mymodel, mytestdata) error <- mytest - mytestdata[,1] -sqrt(mean(error**2)) } Many thanks, Nancy _ [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] R2
Hi everyone, I tried to write the code of computing R2 for a regression system but I failed. This is the code I use for computing RMSE: my_svm_model <- function(myformula, mydata, mytestdata) { mymodel <- svm(myformula, data=mydata) mytest <- predict(mymodel, mytestdata) error <- mytest - mytestdata[,1] -sqrt(mean(error**2)) } can anyone please tell me what I have to change to compute R2 instead of RMSE? Many thanks, Nancy _ [[alternative HTML version deleted]] __ R-help@r-project.org 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.
Re: [R] svm regression/classification
Hi steve, Thank you so much for your reply.Im asking about the difference between two cases:1) when I use svm in a regression system and 2) when I use svm in a classification system. Is the code of using svm in these two cases the same?This is the code for a regression system: my_svm_model <- function(myformula, mydata, mytestdata) { mymodel <- svm(myformula, data=mydata) mytest <- predict(mymodel, mytestdata) error <- mytest - mytestdata[,1] -sqrt(mean(error**2)) }Many thanks, Nancy > Date: Tue, 29 Dec 2009 10:36:36 -0500 > Subject: Re: [R] svm regression/classification > From: mailinglist.honey...@gmail.com > To: nancyada...@hotmail.com > CC: r-help@r-project.org > > Hi Nancy, > > Comments in line: > > On Sun, Dec 27, 2009 at 3:34 AM, Nancy Adam wrote: > > > Hi everyone, > > > > Can anyone please tell whether there is a difference between the code for > > using svm in regression and code for using svm in classification? > > > > This is my code for regression, should I change it to do classification?: > > I'm not sure how to answer your question ... are you asking how you > can explicitly tell the `svm` function to do classification vs. > regression? Or are you asking if classification is better suited for > your problem than regression? > > Are you trying to predict a label or some range of "real valued" > numbers? Can you show us your `y` vector? > > -steve > > -- > 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 _ Keep your friends updatedeven when youre not signed in. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
Re: [R] R2
Hi everyone, Thanks a lot for the explanation⦠I tried the following code to compute R2 for a regression system but it does not work: my_svm_model <- function(myformula, mydata, mytestdata) { mymodel <- svm(myformula, data=mydata) k<- summary(mymodel) k$r.squared } Can anyone please tell me what I have to change to compute R2? Many thanks, Nancy > Date: Tue, 29 Dec 2009 17:28:59 + > From: rip...@stats.ox.ac.uk > To: spec...@stat.berkeley.edu > CC: nancyada...@hotmail.com; r-help@r-project.org > Subject: Re: [R] R2 > > On Tue, 29 Dec 2009, Phil Spector wrote: > > > Nancy - > > Please notice that ** is not an R operator. The caret (^) is the > > exponentiation operator in R. > > - Phil > > Actually, no, > > > 2**3 > [1] 8 > > Indeed ^ is the preferred exponentiation operator, but ** has 'always' > been allowed. See the following note in ?"^" > > Note: > > ʽ**ʼ is translated in the parser to ʽ^ʼ, but this was undocumented > for many years. It appears as an index entry in Becker _et al_ > (1988), pointing to the help for ʽDeprecatedʼ but is not actually > mentioned on that page. Even though it has been deprecated in S > for 20 years, it is still accepted. > > I added that note in May 2008 (and it is not intended to be a > reference to current versions of S-PLUS, since we cannot keep checking > that, but that Svr4 accepted it). > > > > > > > > > On Tue, 29 Dec 2009, Nancy Adam wrote: > > > >> > >> Hi everyone, > >> I tried to write the code of computing R2 for a regression system but I > >> failed. > >> This is the code I use for computing RMSE: > >> > >> my_svm_model <- function(myformula, mydata, mytestdata) > >> { > >> mymodel <- svm(myformula, data=mydata) > >> mytest <- predict(mymodel, mytestdata) > >> error <- mytest - mytestdata[,1] > >> -sqrt(mean(error**2)) > >> > >> } > >> can anyone please tell me what I have to change to compute R2 instead of > >> RMSE? > >> > >> Many thanks, > >> Nancy > >> _ > >> > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@r-project.org 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. > >> > > > > __ > > R-help@r-project.org 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. > > > > -- > Brian D. Ripley, rip...@stats.ox.ac.uk > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 _ Keep your friends updatedâeven when youâre not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] Squared correlation error
Hi everyone, Thanks a lot for the explanation⦠I tried the following code to compute R2 for a regression system but it does not work: my_svm_model <- function(myformula, mydata, mytestdata) { mymodel <- svm(myformula, data=mydata) k<- summary(mymodel) k$r.squared } Can anyone please tell me what I have to change to compute R2? Many thanks, Nancy > > > Date: Tue, 29 Dec 2009 17:28:59 + > > From: rip...@stats.ox.ac.uk > > To: spec...@stat.berkeley.edu > > CC: nancyada...@hotmail.com; > > Subject: Re: [R] R2 > > > > On Tue, 29 Dec 2009, Phil Spector wrote: > > > > > Nancy - > > > Please notice that ** is not an R operator. The caret (^) is the > > > exponentiation operator in R. > > > - Phil > > > > Actually, no, > > > > > 2**3 > > [1] 8 > > > > Indeed ^ is the preferred exponentiation operator, but ** has 'always' > > been allowed. See the following note in ?"^" > > > > Note: > > > > ʽ**ʼ is translated in the parser to ʽ^ʼ, but this was undocumented > > for many years. It appears as an index entry in Becker _et al_ > > (1988), pointing to the help for ʽDeprecatedʼ but is not actually > > mentioned on that page. Even though it has been deprecated in S > > for 20 years, it is still accepted. > > > > I added that note in May 2008 (and it is not intended to be a > > reference to current versions of S-PLUS, since we cannot keep checking > > that, but that Svr4 accepted it). > > > > > > > > > > > > > > On Tue, 29 Dec 2009, Nancy Adam wrote: > > > > > >> > > >> Hi everyone, > > >> I tried to write the code of computing R2 for a regression system but I > > >> failed. > > >> This is the code I use for computing RMSE: > > >> > > >> my_svm_model <- function(myformula, mydata, mytestdata) > > >> { > > >> mymodel <- svm(myformula, data=mydata) > > >> mytest <- predict(mymodel, mytestdata) > > >> error <- mytest - mytestdata[,1] > > >> -sqrt(mean(error**2)) > > >> > > >> } > > >> can anyone please tell me what I have to change to compute R2 instead of > > >> RMSE? > > >> > > >> Many thanks, > > >> Nancy > > >> _ > > >> > > >> > > >> [[alternative HTML version deleted]] > > >> > > >> __ > > >> R-help@r-project.org 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. > > >> > > > > > > __ > > > R-help@r-project.org 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. > > > > > > > -- > > Brian D. Ripley, rip...@stats.ox.ac.uk > > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > > University of Oxford, Tel: +44 1865 272861 (self) > > 1 South Parks Road, +44 1865 272866 (PA) > > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > _ > Keep your friends updatedâeven when youâre not signed in. > http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 > [[alternative HTML version deleted]] > _ Windows Live Hotmail: Your friends can get your Facebook updates, right from Hotmail®. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009 [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] Questions bout SVM
Hi everyone, Can someone please help me in these questions?: 1)if I use crossvalidation with svm, do I have to use this equation to calculate RMSE?: mymodel <- svm(myformula,data=mydata,cross=10) sqrt(mean(mymodel$MSE)) But if I dont use crossvalidation, I have to use the following to calculate RMSE: mymodel <- svm(myformula,data=mydata) mytest <- predict(mymodel, mytestdata) error <- mytest - mytestdata[,1] sqrt(mean(error**2)) 2)if I dont set the parameters of SVM, like in the above, how the program knows them? Or it is a must to determine them when I invoke svm? 3)can you please tell me why we use this equation: mymodel <- svm(myformula,data=mydata)instead of mymodel <- svm(myformula, mydata) and why use this: error <- mytest - mytestdata[,1] instead of error <- mytest mytestdata any help will be really appricaited. Many thanks, Nancy _ Keep your friends updatedeven when youre not signed in. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
Re: [R] Questions bout SVM
Hi Steve, Thanks a lot for your reply.1)Im still confused which equation (1- sqrt(mean(mymodel$MSE)) OR 2- mean(sqrt(mymodel$MSE)) )is equivalent to sqrt(mean(error**2))?I just want to compute the typical RMSE that is usually used for measuring the performance of regression systems. 2)Im talking about another addition related to the svm parameters in the call to SVM. i.e.my_svm_model<- function(myformula, mydata, mytestdata, parameterlist) {mymodel <- svm(myformula, data=mydata, cross=10, cost=parameterlist[[1]], epsilon=parameterlist[[2]],gamma=parameterlist[[3]])If I dont set these parameters of svm (like: my_svm_model<- function(myformula, mydata, mytestdata), how does svm know them? 3) in 2) Is it correct to use mydata instead of data=mydata? Or I can do that only if it is the last argument in the function call? 4)Does mytestdata[,1] means that the model will use only the last column on the testing set?Many thanks,Nancy > Date: Sat, 2 Jan 2010 17:32:44 -0500 > Subject: Re: [R] Questions bout SVM > From: mailinglist.honey...@gmail.com > To: nancyada...@hotmail.com > CC: r-help@r-project.org > > Hi, > > On Fri, Jan 1, 2010 at 1:03 PM, Nancy Adam wrote: > > > > Hi everyone, > > Can someone please help me in these questions?: > > > > 1)if I use crossvalidation with svm, do I have to use this equation to > > calculate RMSE?: > > mymodel <- svm(myformula,data=mydata,cross=10) > > sqrt(mean(mymodel$MSE)) > > No, I don't think so. W/o looking at the C code, I'm guessing that MSE > is a vector of length 10 that represents the mean squared error from > each fold ... but what are you trying to do? Trying to get the average > of the RMSE over all folds? Wouldn't that then be: > mean(sqrt(mymodel$MSE))? > > > But if I dont use crossvalidation, I have to use the following to > > calculate RMSE: > > mymodel <- svm(myformula,data=mydata) > > mytest <- predict(mymodel, mytestdata) > > error <- mytest - mytestdata[,1] > > sqrt(mean(error**2)) > > OK > > > 2)if I dont set the parameters of SVM, like in the above, how the program > > knows them? Or it is a must to determine them when I invoke svm? > > What parameters are you talking about? Your two `svm` function calls > look the same with the exception of not including a value for `cross` > in your 2nd. > > What parameters of the SVM do you think are different? > > > 3)can you please tell me why we use this equation: > > mymodel <- svm(myformula,data=mydata)instead of mymodel <- svm(myformula, > > mydata) > > Since the "data" argument is the 2nd argument in the function > definition of svm.formula, those two invocations are actually the > same. > > > and why use this: > > error <- mytest - mytestdata[,1] instead of error <- mytest mytestdata > > It depends on what type of variable 'mytestdata' is, and its shape, > eg. those two calls might be doing the same thing if mytestdata is > just a 1d matrix. > > -steve > > -- > 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 _ Keep your friends updatedeven when youre not signed in. [[alternative HTML version deleted]] __ R-help@r-project.org 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.
[R] e1071 package
hi all, Im trying to install e1071 package to a new computer but I failed. Can any one please tell me how I download it without installing through R? can anyone please send it as an attachment please? Many thanks, Nancy _ Hotmail: Trusted email with powerful SPAM protection. [[alternative HTML version deleted]] __ R-help@r-project.org 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.