Unverified Commit 15566421 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[examples] Update example notebook (#2391)

* updated default value for precision in plot_importance function

* fixed typo

* updated example notebook
parent ad8e8ccc
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -32,7 +32,7 @@ def plot_importance(booster, ax=None, height=0.2, ...@@ -32,7 +32,7 @@ def plot_importance(booster, ax=None, height=0.2,
xlabel='Feature importance', ylabel='Features', xlabel='Feature importance', ylabel='Features',
importance_type='split', max_num_features=None, importance_type='split', max_num_features=None,
ignore_zero=True, figsize=None, grid=True, ignore_zero=True, figsize=None, grid=True,
precision=None, **kwargs): precision=3, **kwargs):
"""Plot model's feature importances. """Plot model's feature importances.
Parameters Parameters
...@@ -70,7 +70,7 @@ def plot_importance(booster, ax=None, height=0.2, ...@@ -70,7 +70,7 @@ def plot_importance(booster, ax=None, height=0.2,
Figure size. Figure size.
grid : bool, optional (default=True) grid : bool, optional (default=True)
Whether to add a grid for axes. Whether to add a grid for axes.
precision : int or None, optional (default=None) precision : int or None, optional (default=3)
Used to restrict the display of floating point values to a certain precision. Used to restrict the display of floating point values to a certain precision.
**kwargs **kwargs
Other parameters passed to ``ax.barh()``. Other parameters passed to ``ax.barh()``.
...@@ -440,7 +440,7 @@ def _to_graphviz(tree_info, show_info, feature_names, precision=3, constraints=N ...@@ -440,7 +440,7 @@ def _to_graphviz(tree_info, show_info, feature_names, precision=3, constraints=N
if "internal_count" in tree_info['tree_structure']: if "internal_count" in tree_info['tree_structure']:
add(tree_info['tree_structure'], tree_info['tree_structure']["internal_count"]) add(tree_info['tree_structure'], tree_info['tree_structure']["internal_count"])
else: else:
raise Exception("Cannnot plot trees with no split") raise Exception("Cannot plot trees with no split")
if constraints: if constraints:
# "#ddffdd" is light green, "#ffdddd" is light red # "#ddffdd" is light green, "#ffdddd" is light red
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment