bbslover
2010-Nov-07 23:53 UTC
[R] help! kennard-stone algorithm in soil.spec packages does not work for my dataset!!!
http://r.789695.n4.nabble.com/file/n3031344/RSV.Rdata RSV.Rdata I want to split my dataset to training set and test set using kennard-stone(KS) algorithm, it is lucky there is R packages soil.spec to implement it. but when I used it to my dataset, it does not work, who can help me, how reasons is it, below, it is my code, and my data in the attachment. ks<-ken.sto(x,per="TRUE",per.n=0.3,va="FALSE",sav="FALSE") ks % results $`Chosen sample names` NULL $`Chosen row number` integer(0) $`Chosen calibration sample names` [1] "NULL" $`Chosen calibration row number` [1] "NULL" $`Chosen validation sample names` [1] "NULL" $`Chosen validation row number` [1] "NULL" attr(,"class") why it is all NULL ? and> ks<-ken.sto(x,per="TRUE",per.n=0.3,va="TRUE",sav="FALSE")Error in val.min[i] <- blub[sample(length(blub), 1)] : replacement has length zero In addition: Warning message: In min(prco[-cal.start.n, i]) : no non-missing arguments to min; returning Inf if I set va="TRUE", appearing the errors. I hope some friends can help me ! -- View this message in context: http://r.789695.n4.nabble.com/help-kennard-stone-algorithm-in-soil-spec-packages-does-not-work-for-my-dataset-tp3031344p3031344.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2010-Nov-08 00:21 UTC
[R] help! kennard-stone algorithm in soil.spec packages does not work for my dataset!!!
On Nov 7, 2010, at 6:53 PM, bbslover wrote:> > http://r.789695.n4.nabble.com/file/n3031344/RSV.Rdata RSV.Rdata > I want to split my dataset to training set and test set using > kennard-stone(KS) algorithm, it is lucky there is R packages > soil.spec to > implement it. > > but when I used it to my dataset, it does not work, who can help me, > how > reasons is it, below, it is my code, and my data in the attachment.No attachment, athough partial credit for making the effort. Most probable cause... failing to read Posting Guide. -- David.> > ks<-ken.sto(x,per="TRUE",per.n=0.3,va="FALSE",sav="FALSE") > ks > > % results > > $`Chosen sample names` > NULL > > $`Chosen row number` > integer(0) > > $`Chosen calibration sample names` > [1] "NULL" > > $`Chosen calibration row number` > [1] "NULL" > > $`Chosen validation sample names` > [1] "NULL" > > $`Chosen validation row number` > [1] "NULL" > > attr(,"class") > > why it is all NULL ? > > > and > >> ks<-ken.sto(x,per="TRUE",per.n=0.3,va="TRUE",sav="FALSE") > Error in val.min[i] <- blub[sample(length(blub), 1)] : > replacement has length zero > In addition: Warning message: > In min(prco[-cal.start.n, i]) : > no non-missing arguments to min; returning Inf > > if I set va="TRUE", appearing the errors.David Winsemius, MD West Hartford, CT
bbslover
2010-Nov-08 14:44 UTC
[R] help! kennard-stone algorithm in soil.spec packages does not work for my dataset!!!
http://r.789695.n4.nabble.com/file/n3032045/rsv1.txt rsv1.txt I am very grateful to David's suggestion, here , I upload my dataset "rsv1.txt", also the question, ks<-ken.sto(rsv1,per="TRUE",per.n=0.3,va="FALSE",sav="FALSE") it does not work, all results are NULL, i do not known why it is ? hope, friends can give me a hand! thanks kevin -- View this message in context: http://r.789695.n4.nabble.com/help-kennard-stone-algorithm-in-soil-spec-packages-does-not-work-for-my-dataset-tp3031344p3032045.html Sent from the R help mailing list archive at Nabble.com.
Leonardo Ramirez-Lopez
2012-Jan-18 14:00 UTC
[R] help! kennard-stone algorithm in soil.spec packages does not work for my dataset!!!
Hi all Certainly there are some problems with the "ken.sto" function. In addition there are some considerations that need to be taken into account before using this code. For instance, it projects the data onto a principal component space prior sampling. In this case is necessary to check if a PCA is really necessary. Second, this function uses the Euclidean distance (ED) as metric for selecting the samples. By using the ED directly on the PCs, the PCs with high explained variance will ?dominate? the measurements. In this case is better to standardize the PCs prior ED computation or use the Mahalanobis distance. Whatever, I have modified the ?ken.sto? code and now seems to be that it works correctly. If some of you still need it just drop me an e-mail. Regards, Leonardo Ramirez-Lopez, Researcher Georges Lema?tre Centre for Earth and Climate Research Earth and Life Institute Universit? Catholique de Louvain, 3 Place Louis Pasteur 1348, Louvain la Neuve Belgium e-mail: leonardo.ramirez at uclouvain.be http://www.uclouvain.be/en-teclim.html Ph.D Researcher Physical Geography and Soil Science Institute of Geography University of T?bingen R?melinstr. 19-23 72070 T?bingen Germany http://www.geographie.uni-tuebingen.de/ -- View this message in context: http://r.789695.n4.nabble.com/help-kennard-stone-algorithm-in-soil-spec-packages-does-not-work-for-my-dataset-tp3031344p4306703.html Sent from the R help mailing list archive at Nabble.com.