Skip to content

Commit

Permalink
Link to example from docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
ogrisel committed Nov 11, 2022
1 parent 766d1f8 commit 1925f0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions examples/ensemble/plot_monotonic_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
# trend and ignores the local variations.

# %%
# .. monotonic_cst_features_names:
#
# Using feature names to specify monotonic constraints
# ----------------------------------------------------
#
# Note that if the training data has feature names, it's possible to specifiy the
# monotonic constraints by passing a dictionary:
import pandas as pd
Expand Down
6 changes: 4 additions & 2 deletions sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,8 @@ class HistGradientBoostingRegressor(RegressorMixin, BaseHistGradientBoosting):
- -1: monotonic decrease
If a dict with str keys, map feature to monotonic constraints by name.
If an array, the feature are mapped to constraints by position.
If an array, the feature are mapped to constraints by position. See
example usage :ref:`monotonic_cst_features_names`.
The constraints are only valid for binary classifications and hold
over the probability of the positive class.
Expand Down Expand Up @@ -1580,7 +1581,8 @@ class HistGradientBoostingClassifier(ClassifierMixin, BaseHistGradientBoosting):
- -1: monotonic decrease
If a dict with str keys, map feature to monotonic constraints by name.
If an array, the feature are mapped to constraints by position.
If an array, the feature are mapped to constraints by position. See
example usage in :ref:`monotonic_cst_features_names`.
The constraints are only valid for binary classifications and hold
over the probability of the positive class.
Expand Down

0 comments on commit 1925f0b

Please sign in to comment.