pca feature selection

Solutions on MaxInterview for pca feature selection by the best coders in the world

showing results for - "pca feature selection"
Felipe
26 Mar 2018
1# Feature Importance with Extra Trees Classifier
2from pandas import read_csv
3from sklearn.ensemble import ExtraTreesClassifier
4# load data
5url = "https://raw.githubusercontent.com/jbrownlee/Datasets/master/pima-indians-diabetes.csv"
6names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']
7dataframe = read_csv(url, names=names)
8array = dataframe.values
9X = array[:,0:8]
10Y = array[:,8]
11# feature extraction
12model = ExtraTreesClassifier(n_estimators=10)
13model.fit(X, Y)
14print(model.feature_importances_)
15