import pandas,pylab; from sklearn import linear_model as lm
from sklearn import datasets,feature_selection
from sklearn.ensemble import GradientBoostingClassifier as GBC
from sklearn.ensemble import AdaBoostClassifier as ABC
return [dict(selector='th',
props=[('font-size','14pt'),
props=[('font-size','10pt'),
('text-align','center')]),
dict(selector='tr:hover th:hover',
props=[('color','darkblue'),
('text-shadow','3px 3px 3px #aaa')]),
dict(selector='tr:hover td:hover',
props=[('font-size','14pt'),
('text-shadow','3px 3px 3px #aaa')])]
wine=datasets.load_wine(); X,y=wine.data,wine.target
selected_features=pandas.DataFrame(columns=range(13))
selected_features.loc['Gradient Boosting']=\
GBC().fit(X,y).feature_importances_
selected_features.loc['Ada Boost']=\
ABC().fit(X,y).feature_importances_
.SelectKBest(score_func=feature_selection.chi2,k=3)
selected_features.loc['Select KBest']=kbest.fit(X,y).pvalues_
lmlr=lm.LogisticRegression(
solver='liblinear',multi_class='ovr')
rfe=feature_selection.RFE(lmlr,n_features_to_select=3)
selected_features.loc['RFE']=1/rfe.fit(X,y).ranking_
display(selected_features.T.style.set_table_styles(pd_style()))
f,ax=pylab.subplots(1,figsize=(6,4))
selected_features.T.plot(ax=ax)
pylab.grid(); pylab.show()