(forest)
| 5 | import sys |
| 6 | |
| 7 | def print_importance(forest): |
| 8 | importances = forest.feature_importances_ |
| 9 | indices = np.argsort(importances)[::-1] |
| 10 | # Compute stddev of forest's feature importances over all trees |
| 11 | std = np.std([tree.feature_importances_ for tree in forest.estimators_], axis=0) |
| 12 | for f in range(X_training.shape[1]): |
| 13 | print "%d. feature %s col %d (%f, inter-tree variability=%f)" % \ |
| 14 | (f + 1, |
| 15 | token_features[indices[f]], |
| 16 | indices[f], |
| 17 | importances[indices[f]], |
| 18 | std[indices[f]]) |
| 19 | |
| 20 | def graph_importance(forest): |
| 21 | importances = forest.feature_importances_ |
no outgoing calls
no test coverage detected