Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Adds Plotting API to Partial Dependence #14646

Merged
merged 36 commits into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fa93505
WIP
thomasjpfan Aug 8, 2019
d1dc257
Merge remote-tracking branch 'upstream/master' into plotting_api_part…
thomasjpfan Aug 12, 2019
1dac62c
WIP Adding tests
thomasjpfan Aug 12, 2019
bc45123
WIP Doc
thomasjpfan Aug 13, 2019
9d67f6a
CLN Creates _plot folder
thomasjpfan Aug 13, 2019
5129289
CLN Adds _plot into setup
thomasjpfan Aug 13, 2019
6f5407e
CLN Fixes bugs
thomasjpfan Aug 13, 2019
8bc2433
DOC Adds dev docs
thomasjpfan Aug 14, 2019
4aa273c
ENH Updates API
thomasjpfan Aug 14, 2019
5263235
Merge remote-tracking branch 'upstream/master' into plotting_api_part…
thomasjpfan Aug 15, 2019
045aa8f
CLN Address comments
thomasjpfan Aug 16, 2019
75f8ed8
TST Removes check
thomasjpfan Aug 16, 2019
5fddc5f
DOC Address comments
thomasjpfan Aug 16, 2019
396f1cb
DOC Uses normal decision tree in example
thomasjpfan Aug 16, 2019
bd121c3
CLN Refactor array-like
thomasjpfan Aug 16, 2019
422992e
STY Minor
thomasjpfan Aug 16, 2019
ca532d7
DOC Update
thomasjpfan Aug 16, 2019
7316ef5
TST trigger
thomasjpfan Aug 16, 2019
9b916cf
DOC Update docstring
thomasjpfan Aug 26, 2019
ec47bd8
Merge remote-tracking branch 'upstream/master' into plotting_api_part…
thomasjpfan Aug 27, 2019
170a1b5
DOC Adds new plotting api section
thomasjpfan Aug 27, 2019
9ad9477
DOC Uses :: syntax
thomasjpfan Aug 27, 2019
cab552a
CLN Moves files around
thomasjpfan Sep 4, 2019
0f5dee1
DOC Updates plotting.rst
thomasjpfan Sep 5, 2019
e7965d9
DOC Address comments
thomasjpfan Sep 5, 2019
24ee8b0
CLN Address comments
thomasjpfan Sep 5, 2019
d339328
CLN Address comments
thomasjpfan Sep 5, 2019
f7e946d
Merge remote-tracking branch 'upstream/master' into plotting_api_part…
thomasjpfan Sep 5, 2019
480bcef
DOC More links
thomasjpfan Sep 5, 2019
e9e5d3a
DOC More words
thomasjpfan Sep 5, 2019
4b50a8b
BUG Fix setup file
thomasjpfan Sep 7, 2019
f77f5d1
DOC Fix
thomasjpfan Sep 9, 2019
612a80e
REV Remove unrelated commit
thomasjpfan Sep 12, 2019
a8182d8
Merge remote-tracking branch 'upstream/master' into plotting_api_part…
thomasjpfan Sep 12, 2019
6c3a6c9
Merge remote-tracking branch 'upstream/master' into plotting_api_part…
thomasjpfan Sep 19, 2019
42e0c9b
CLN Address @glemaitre comments
thomasjpfan Sep 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions sklearn/inspection/_plot/partial_dependence.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ class PartialDependenceDisplay:

Parameters
----------
pd_results : list of (ndarray, ndarray)
pd_results : (ndarray, ndarray) list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

list of tuples?

Results of `sklearn.inspection.partial_dependence` for ``features``.
glemaitre marked this conversation as resolved.
Show resolved Hide resolved
Each tuple corresponds to a (averaged_predictions, grid).

features : list of {(int, ), (int, int)}
features {(int, ), (int, int)} list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I miss a discussion about this style?

Indices of features for a given plot. A tuple of one integer will plot
a partial dependence curve of one feature. A tuple of two integers will
plot a two-way partial dependence curve as a contour plot.

feature_names : list of str
feature_names : str list
Feature names corrsponding to the indicies in ``features``.

target_idx : int
Expand Down Expand Up @@ -96,8 +96,7 @@ def plot(self, ax=None, n_cols=3, line_kw=None, contour_kw=None, fig=None):

Parameters
----------
ax : Matplotlib axes, list of Matplotlib axes, ndarray of Matplotlib \
Axes, default=None
ax : Matplotlib axes or Matplotlib axes array-like, default=None
Axes to plot the partial dependence curves.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect indentation in this whole section, doc isn't rendered properly

- If a single axes is given, it is treated as a bounding axes and
a grid of partial depedendence plots will be drawn within these
Expand All @@ -110,15 +109,15 @@ def plot(self, ax=None, n_cols=3, line_kw=None, contour_kw=None, fig=None):
n_cols : int, default=3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I hate the way this is currently done and we should be doing what dabl is doing or https://github.com/matplotlib/grid-strategy is doing but that's for another day lol.

The maximum number of columns in the grid plot.

line_kw : dict or None, default=None
line_kw : dict, default=None
Dict with keywords passed to the `matplotlib.pyplot.plot` call.
For one-way partial dependence plots.

contour_kw : dict or None, default=None
contour_kw : dict, default=None
Dict with keywords passed to the `matplotlib.pyplot.contourf`
call for two-way partial dependence plots.

fig : Matplotlib figure object or None, default=None
fig : Matplotlib figure object, default=None
A figure object onto which the plots will be drawn, after the
figure has been cleared. By default, a new one is created.

Expand Down
3 changes: 1 addition & 2 deletions sklearn/inspection/partial_dependence.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,7 @@ def plot_partial_dependence(estimator, X, features, feature_names=None,
Dict with keywords passed to the ``matplotlib.pyplot.contourf`` call.
For two-way partial dependence plots.

ax : Matplotlib axes, list of Matplotlib axes, ndarray of Matplotlib \
Axes, default=None
ax : Matplotlib axes or Matplotlib axes array-like, default=None
Axes to plot the partial dependence curves.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue about rendered docs

- If a single axes is given, it is treated as a bounding axes and
a grid of partial depedendence plots will be drawn within these
Expand Down