we can observe from the above output that principal components bear little resemblance to the source data feature importance as the name suggestsfeature importance technique is used to choose the importance features it basically uses trained supervised classifier to select features we can implement this feature selection technique with the help of extratreeclassifier class of scikit-learn python library example in this examplewe will use extratreeclassifier to select features from pima indians diabetes dataset from pandas import read_csv from sklearn ensemble import extratreesclassifier path ' :\desktop\pima-indians-diabetes csvnames ['preg''plas''pres''skin''test''mass''pedi''age''class'dataframe read_csv(datanames=namesarray dataframe values nextwe will separate array into input and output componentsx array[:, : array[:, the following lines of code will extract features from datasetmodel extratreesclassifier(model fit(xyprint(model feature_importances_output from the outputwe can observe that there are scores for each attribute the higher the scorehigher is the importance of that attribute