I am explaining the scenario with a piece of data:
Ex. data set.
GA_ID PN_ID PC_ID MBP_ID GR_ID AP_ID class
0.033 6.652 6.681 0.194 0.874 3.177 0
0.034 9.039 6.224 0.194 1.137 0 0
0.035 10.936 10.304 1.015 0.911 4.9 1
0.022 10.11 9.603 1.374 0.848 4.566 1
0.035 2.963 17.156 0.599 0.823 9.406 1
0.033 10.872 10.244 1.015 0.574 4.871 1
0.035 21.694 22.389 1.015 0.859 9.259 1
0.035 10.936 10.304 1.015 0.911 4.9 1
0.035 10.936 10.304 1.015 0.911 4.9 1
0.035 10.936 10.304 1.015 0.911 4.9 0
0.036 1.373 12.034 0.35 0.259 5.723 0
0.033 9.831 9.338 0.35 0.919 4.44 0
feature selection step 1 and its out come : VarianceThreshol
PN_ID PC_ID MBP_ID GR_ID AP_ID class
6.652 6.681 0.194 0.874 3.177 0
9.039 6.224 0.194 1.137 0 0
10.936 10.304 1.015 0.911 4.9 1
10.11 9.603 1.374 0.848 4.566 1
2.963 17.156 0.599 0.823 9.406 1
10.872 10.244 1.015 0.574 4.871 1
21.694 22.389 1.015 0.859 9.259 1
10.936 10.304 1.015 0.911 4.9 1
10.936 10.304 1.015 0.911 4.9 1
10.936 10.304 1.015 0.911 4.9 0
1.373 12.034 0.35 0.259 5.723 0
9.831 9.338 0.35 0.919 4.44 0
feature selection step 2 and its out come : Tree-based feature selection (Ex. from klearn.ensemble import ExtraTreesClassifier)
PN_ID MBP_ID GR_ID AP_ID class
6.652 0.194 0.874 3.177 0
9.039 0.194 1.137 0 0
10.936 1.015 0.911 4.9 1
10.11 1.374 0.848 4.566 1
2.963 0.599 0.823 9.406 1
10.872 1.015 0.574 4.871 1
21.694 1.015 0.859 9.259 1
10.936 1.015 0.911 4.9 1
10.936 1.015 0.911 4.9 1
10.936 1.015 0.911 4.9 0
1.373 0.35 0.259 5.723 0
9.831 0.35 0.919 4.44 0
Here we can conclude that we started with 6 columns(features) and one class label and at the final step reduced down it to 4 features and one class label. GA_ID and PC_ID columns has been removed, while model has been constructed using PN_ID, MBP_ID, GR_ID and AP_ID features.
But unfortunately when i performed feature selection with the available methods in scikit-learn library I found that it returns only shape of the data and reduced data without the name of the selected and omitted features.
I have write down many stupid python codes (as i m not very experience programmer) to find the answer but not succeeded.
kindly please suggest me some way to get out of it thanks
(Note: Particularly for this post i have never performed any feature selection method on the given example data set, rather i have deleted the column randomly to explain the case)
Perhaps this code and commented explanations will help (adapted from here).