selectfrommodel tree based model
from sklearn.ensemble import GradientBoostingClassifier from sklearn.feature_selection import SelectFromModel model = GradientBoostingClassifier() tree_based = SelectFromModel(estimator=model).fit(df,y) data_transformed = tree_based.transform(df) tree_based.get_feature_names_out()