Skip to main content
9 events
when toggle format what by license comment
Apr 13, 2017 at 12:44 history edited CommunityBot
replaced http://stats.stackexchange.com/ with https://stats.stackexchange.com/
Jan 17, 2015 at 16:03 history closed amoeba
kjetil b halvorsen
Xi'an
gung - Reinstate Monica
Scortchi
Duplicate of PCA and the train/test split
Jan 17, 2015 at 13:34 review Close votes
Jan 17, 2015 at 16:03
Jan 16, 2015 at 21:02 comment added amoeba @drj: No, don't delete your post! I would suggest that you update it with a short update that answers your own confusion (and/or perhaps extends the code -- as you wish). And we will mark it as a duplicate of "PCA and train/test split". Your question might help somebody in the future.
Jan 16, 2015 at 19:15 comment added drj @amoeba, I was concerned that because gridsearchCV is performing a 3-fold cross-validation that there was a problem that with performing the PCA outside of gridsearchCV. However after thinking about it some more, I think you are correct in that there is no problem because the code is not attempting to cross-validation to estimate the performance of the model. Instead, we are just using our test data to measure the performance at the end. cbeleites, you also have a good point about the way the code is structured. I can add the SVM validation to the example, or should I delete the post? Thanks!
Jan 16, 2015 at 14:55 comment added cbeleites I agree with @amoeba. The example code is missing the validation of the optimized SVM, which however can be done with X_test_pca. Personally, I think it is a bit unfortunate that the code is not completely separated into training code and testing code (i.e. I'd move applying the PCA to the test data to the very bottom of the code and then go on with testing the SVM).
Jan 16, 2015 at 13:34 comment added amoeba I don't understand why this is not a duplicate of "PCA and train/test split". Can you please clarify your confusion? Your conceptual understanding is correct: PCA is done on the training data and then the same transformation is applied to the trainining and testing data. This seems to be exactly what is done in the scikit code your pasted here. So what's the problem?
Jan 16, 2015 at 9:02 review First posts
Jan 16, 2015 at 9:05
Jan 16, 2015 at 9:01 history asked drj CC BY-SA 3.0