def select_features(rf): """ return the index of the features that have importance above average """ ft_names = feature_names() idx = np.arange(len(ft_names)) importances = rf.feature_importances_ ft = zip(idx, 100.0 * importances/importances.max()) ft_sorted = sorted(ft, key=lambda x: x[1], reverse=True) return [tup[0] for tup in ft_sorted]
def select_features(rf): """ return the index of the features that have importance above average """ ft_names = feature_names() idx = np.arange(len(ft_names)) importances = rf.feature_importances_ ft = zip(idx, 100.0 * importances / importances.max()) ft_sorted = sorted(ft, key=lambda x: x[1], reverse=True) return [tup[0] for tup in ft_sorted]
def var_importance(rf): ft_names = feature_names() importances = rf.feature_importances_ ft = zip(ft_names, 100.0 * importances/importances.max()) ft_sorted = sorted(ft, key=lambda x: x[1]) return np.asarray(ft_sorted)
def var_importance(rf): ft_names = feature_names() importances = rf.feature_importances_ ft = zip(ft_names, 100.0 * importances / importances.max()) ft_sorted = sorted(ft, key=lambda x: x[1]) return np.asarray(ft_sorted)