aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/estimator/canned
diff options
context:
space:
mode:
authorGravatar Yan Facai (颜发才) <facai.yan@gmail.com>2018-08-19 17:28:12 +0800
committerGravatar Yan Facai (颜发才) <facai.yan@gmail.com>2018-08-19 17:28:12 +0800
commit52d637e604dacd3bff836a27bd991f95966226e8 (patch)
tree31185f607867e57821c807816433fb3a8949bf42 /tensorflow/python/estimator/canned
parent7ed06809ba3aabf1d93cf726a0b9b6416d80ef85 (diff)
CLN: normalize is False by default
Diffstat (limited to 'tensorflow/python/estimator/canned')
-rw-r--r--tensorflow/python/estimator/canned/boosted_trees.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tensorflow/python/estimator/canned/boosted_trees.py b/tensorflow/python/estimator/canned/boosted_trees.py
index 62757ef588..c59b59b653 100644
--- a/tensorflow/python/estimator/canned/boosted_trees.py
+++ b/tensorflow/python/estimator/canned/boosted_trees.py
@@ -956,9 +956,7 @@ def _compute_feature_importances_per_tree(tree, num_features):
return importances
-def _compute_feature_importances(tree_ensemble,
- num_features,
- normalize=True):
+def _compute_feature_importances(tree_ensemble, num_features, normalize):
"""Compute the feature importances.
The higher the value, the more important the feature.
@@ -972,6 +970,9 @@ def _compute_feature_importances(tree_ensemble,
sorted_feature_idx: A list of feature_id which is sorted
by its feature importance.
feature_importances: A list of corresponding feature importance.
+
+ Raises:
+ AssertionError: Trees are all empty or root node only when normalizing.
"""
tree_importances = [_compute_feature_importances_per_tree(tree, num_features)
for tree in tree_ensemble.trees]
@@ -996,7 +997,7 @@ class _BoostedTrees(estimator.Estimator):
self._sorted_feature_columns = sorted(feature_columns, key=lambda tc: tc.name)
- def experimental_feature_importances(self, normalize=True):
+ def experimental_feature_importances(self, normalize=False):
"""Compute the feature importances.
The higher the value, the more important the corresponding feature.
@@ -1005,9 +1006,9 @@ class _BoostedTrees(estimator.Estimator):
normalize: If True, normalize the feature importances.
Returns:
- sorted_feature_names: A list of feature name which is sorted
+ sorted_feature_names: 1-D array of feature name which is sorted
by its feature importance.
- feature_importances: A list of corresponding feature importance.
+ feature_importances: 1-D array of the corresponding feature importance.
Raises:
ValueError: Empty ensemble.