Skip to content

[WIP] improving equality test in sklearn's clone function#5525

Closed
dohmatob wants to merge 1 commit intoscikit-learn:masterfrom
dohmatob:fix-5522
Closed

[WIP] improving equality test in sklearn's clone function#5525
dohmatob wants to merge 1 commit intoscikit-learn:masterfrom
dohmatob:fix-5522

Conversation

@dohmatob
Copy link
Copy Markdown
Contributor

This PR addresses issue #5522.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would rather raise a SkipTest('pandas required') exception to make it more explicit that this test was not run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes indeed. thanks.

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Oct 22, 2015

clone would have the same problem with a numpy array passed as an input parameter right? Testing this would not require the dependency on pandas at test time.

@dohmatob
Copy link
Copy Markdown
Contributor Author

@ogrisel: No, ndarrays are handled separately in the function.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we have a mock dataframe object.

@amueller
Copy link
Copy Markdown
Member

I am not sure I understand why this works. maybe @GaelVaroquaux can say something about it. Shouldn't we be deepcopying the dataframe? We deepcopy numpy arrays, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The fix looks good (although it took me a minute to realize why :) )

@GaelVaroquaux
Copy link
Copy Markdown
Member

We deepcopy everything that is not an estimator (line 49 of base.py).

@amueller
Copy link
Copy Markdown
Member

yeah but why is is true after deepcopying something?

@GaelVaroquaux
Copy link
Copy Markdown
Member

GaelVaroquaux commented Oct 22, 2015 via email

@amueller
Copy link
Copy Markdown
Member

Argh... so both me and @GaelVaroquaux where a little unclear on what is happening here. I'll post the correct fix in a minute.

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Oct 23, 2015

I think #5540 is a better fix.

@ogrisel ogrisel changed the title [WIP] improving equality test inf sklearn's cloning function [WIP] improving equality test in sklearn's clone function Oct 23, 2015
@dohmatob dohmatob closed this Nov 2, 2015
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.

4 participants