0

In order to to ensure a good population representation I have created custom validation sets from my training data. However, I am not sure how I interface this in PCR in R

I have tried to add a list in the segments argument with each index similar to what you do in python predefined splits cv iterator, which runs but takes forever. So I feel I must be making an error somewhere

 pcr(y~X,scale=FALSE,data=tdata,validation="CV",segments=test_fold)

where test fold is a list containing the validation set which belongs in the index

For example if the training data is composed on 9 samples and I want to use the first three as the first validation set on son

test_fold<-c(1,1,1,2,2,2,3,3,3) 

This runs but it is very slow where if I do regular "CV" it runs in minutes. So far the results look okay but I have a over a thousand runs I need to do and it took 1 hr to get through one. So if anybody knows how I can speed this up I would be grateful.

1 Answers1

0

So the segments parameters needs to be a list of multiple vectors. So going again with 9 samples if I want the first three to be in the first validation set, the next three in the second validation set and so on it should be

test_vec<-list(c(1,2,3),c(4,5,6),c(7,8,9))