alexkychen / assignPOP

Population Assignment using Genetic, Non-genetic or Integrated Data in a Machine-learning Framework. Methods in Ecology and Evolution. 2018;9:439–446.
http://alexkychen.github.io/assignPOP/
GNU General Public License v3.0
17 stars 3 forks source link

issue with assign MC #12

Open Farhad63 opened 4 years ago

Farhad63 commented 4 years ago

Hi Thanks for your very interesting program when I try assign.MC( myGenepopRd, train.inds=c(0.5, 0.7), train.loci=c(0.1, 0.25, 0.5, 1), loci.sample="fst", iterations=30, model="LDA", dir="Result-folder/") it does the assignment successfully "Monte-Carlo cross-validation done!! 240 assignment tests completed!!" but doesn't write the assignment files to the result folder (only write the info file: AnalysisInfo.txt) I appreciate if you let me know what is the problem

alexkychen commented 4 years ago

Hi, Thank you for using our R package. Try to use lower case in your model name (model = "lda"). Somehow it's case sensitive.

Alex

Farhad63 commented 4 years ago

Hi Thanks for your reply, yeah seems I have made a typo here, I corrected it. I know get below error while trying accuracy.plot(accuMC, pop = "all") Error in accuracy.plot(accuMC, pop = "all") : object 'checkTrainInds' not found

and this one for membership.plot(dir = "Result_MC/") Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'Result_MC/Out_0.5_K0.25_1.txt': No such file or directory

alexkychen commented 4 years ago

Hi, First, it looks like that your "training individual" variable in the accuMC was not read correctly. Make sure your accuMC is an object returned from the function accuracy.MC or accuracy.kfold or a data frame read from read.table or read.csv. You could use str(accuMC) to see what it looks like. It should be something like the following.

str(accuMC) 'data.frame': 160 obs. of 7 variables: $ train.inds : Factor w/ 2 levels "0.5","0.7": 1 1 1 1 1 1 1 1 1 1 ... $ train.loci : Factor w/ 4 levels "0.1","0.25","0.5",..: 1 1 1 1 1 1 1 1 1 1 ... $ iters : Factor w/ 20 levels "1","10","11",..: 1 2 3 4 5 6 7 8 9 10 ... $ assign.rate.all : num 0.667 0.622 0.622 0.689 0.533 ... $ assign.rate.pop.1: num 0.333 0 0.4 0.4 0.733 ... $ assign.rate.pop.2: num 0.667 0.867 0.467 0.733 0.333 ... $ assign.rate.pop.3: num 1 1 1 0.933 0.533 ..

Or, you could open the file "Rate_of_xxx_tests_x_pop.txt" in your folder and see if there's a column or something missing. Pay attention to the column $train.inds and its data type (should be a Factor variable).

Second, the function membership.plot can only be used for the results generated from assign.kfold (k-fold cross-validation), not assign.MC (Monte-Carlo cross-validation). I guess you used it on your assign.MC results, so it gave you the error message.

Hope it helps.