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 DataConversionWarning: Add example to doc of DataCon… #16704

Merged

Conversation

danielvangelder
Copy link
Contributor

Reference Issues/PRs

One of the TODO's in #3846, the DataConversionWarning class needed an example in the doc. Therefore I took inspiration from the example in the FitFailedWarning class doc.

What does this implement/fix? Explain your changes.

Adds an example to the class description where the warning is triggered.

Any other comments?

This is my first PR to scikit-learn so I'm happy to hear if any changes are necessary!

@danielvangelder danielvangelder changed the title Add example to doc of DataConversionWarning class DataConversionWarning: Add example to doc of DataConversionWarning class Mar 16, 2020
Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

@danielbarkhorn I see this is your first time contributing, welcome!

>>> with warnings.catch_warnings(record=True) as w:
... try:
... # Will trigger warning as metric requires X.dtype=bool
... D = pairwise_distances(X, metric="jaccard")
Copy link
Member

Choose a reason for hiding this comment

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

May we use column_or_1d instead as an example that issues a DataConversionWarning warning? I think users would run into that situation more often.

@danielvangelder danielvangelder changed the title DataConversionWarning: Add example to doc of DataConversionWarning class [MRG] DOC DataConversionWarning: Add example to doc of DataConversionWarning class Mar 23, 2020
@Malesche Malesche mentioned this pull request Mar 29, 2020
23 tasks
sklearn/exceptions.py Outdated Show resolved Hide resolved
Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

LGTM

@jnothman jnothman changed the title [MRG] DOC DataConversionWarning: Add example to doc of DataConversionWarning class DOC DataConversionWarning: Add example to doc of DataCon… Apr 19, 2020
@jnothman jnothman merged commit 5dfca46 into scikit-learn:master Apr 19, 2020
@jnothman
Copy link
Member

Thanks @toondeboer

gio8tisu pushed a commit to gio8tisu/scikit-learn that referenced this pull request May 15, 2020
viclafargue pushed a commit to viclafargue/scikit-learn that referenced this pull request Jun 26, 2020
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.

3 participants