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

DOC Adds note regarding plot partial dependence with the same axes #15599

Conversation

thomasjpfan
Copy link
Member

Reference Issues/PRs

Addresses #15581

What does this implement/fix? Explain your changes.

Adds note regarding using plot_partial_dependence with the same axes

Any other comments?

@adrinjalali
Copy link
Member

Test failing

___ [doctest] sklearn.inspection._partial_dependence.plot_partial_dependence ___
[gw0] linux -- Python 3.7.5 /usr/share/miniconda/envs/testvenv/bin/python
427 
428     .. note::
429 
430         :func:`plot_partial_dependence` does not support using the same axes
431         with multiple calls. To plot the the partial dependence for multiple
432         estimators, please pass the axes created by the first call to the
433         second call::
434 
435           >>> from sklearn.inspection import plot_partial_dependence
436           >>> disp1 = plot_partial_dependence(...)
UNEXPECTED EXCEPTION: TypeError("plot_partial_dependence() missing 2 required positional arguments: 'X' and 'features'")
Traceback (most recent call last):

  File "/usr/share/miniconda/envs/testvenv/lib/python3.7/doctest.py", line 1329, in __run
    compileflags, 1), test.globs)

  File "<doctest sklearn.inspection._partial_dependence.plot_partial_dependence[1]>", line 1, in <module>

TypeError: plot_partial_dependence() missing 2 required positional arguments: 'X' and 'features'

/home/vsts/work/1/s/sklearn/inspection/_partial_dependence.py:436: UnexpectedException

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

Only a nitpicks, LGTM

>>> from sklearn.linear_model import LinearRegression
>>> X, y = make_friedman1()
>>> est = LinearRegression().fit(X, y)
>>> disp1 = plot_partial_dependence(est, X) #doctest: +SKIP
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> disp1 = plot_partial_dependence(est, X) #doctest: +SKIP
>>> disp1 = plot_partial_dependence(est, X) # doctest: +SKIP

>>> est = LinearRegression().fit(X, y)
>>> disp1 = plot_partial_dependence(est, X) #doctest: +SKIP
>>> disp2 = plot_partial_dependence(est, X,
... ax=disp1.axes_) #doctest: +SKIP
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
... ax=disp1.axes_) #doctest: +SKIP
... ax=disp1.axes_) # doctest: +SKIP

@glemaitre glemaitre merged commit f1d8832 into scikit-learn:master Nov 14, 2019
@glemaitre
Copy link
Member

@thomasjpfan Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants