I'm using a supervised machine learning algorithm on some big data. There is much more features than observations. To reduce the number of features, I would like to do some feature selection. However, there is one thing I'm confused about. May I do the feature selection first, using data from all observations, and then do the training and testing of the classifier?
1 Answer
In any case you should always split your data into a development and a test set. You will look at the test set only once, which is when you evaluate the model you build, where model also includes the feature selection process.
Never use the test set during model selection.
Anything else is extremly dangerous in your setting. In case you need to look at the test set multiple times, you should have a range of test sets which you can add to your development set after each iteration.