Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG+1] copy not passed from linear_model/base.py:_pre_fit to _preprocess_data #9347

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

Merged
merged 3 commits into from
Jul 16, 2017

Conversation

balakmran
Copy link
Contributor

@balakmran balakmran commented Jul 13, 2017

Reference Issue

Fixes #9345

What does this implement/fix? Explain your changes.

Added copy parameter to _preprocess_data method
Fixes issue discussed in lgtmhq/lgtm-queries#14

@balakmran balakmran changed the title copy not passed from linear_model/base.py:_pre_fit to _preprocess_data [MRG] copy not passed from linear_model/base.py:_pre_fit to _preprocess_data Jul 13, 2017
@@ -523,7 +523,7 @@ def _pre_fit(X, y, Xy, precompute, normalize, fit_intercept, copy):
precompute = False
X, y, X_offset, y_offset, X_scale = _preprocess_data(
X, y, fit_intercept=fit_intercept, normalize=normalize,
return_mean=True)
copy=copy, return_mean=True)
Copy link
Member

Choose a reason for hiding this comment

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

I suspect you should never copy for a sparse matrix as X will not be densified hence modified anyway. So copy should be False all the time. Can you check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, got it. Let me change to copy=False.
Read through this now
copy : boolean (default=False)
Whether a forced copy will be triggered. If copy=False, a copy might
be triggered by a conversion.

@agramfort
Copy link
Member

LGTM

+1 for MRG

@agramfort agramfort changed the title [MRG] copy not passed from linear_model/base.py:_pre_fit to _preprocess_data [MRG+1] copy not passed from linear_model/base.py:_pre_fit to _preprocess_data Jul 14, 2017
@amueller
Copy link
Member

why copy=False not copy=copy

@agramfort
Copy link
Member

because if you pass copy=True it makes a copy of X although X is not modified inplace when X is sparse. clear?

@amueller
Copy link
Member

@agramfort not really clear unless you go read the code of the _preprocess_data function. So I think there should be a comment.

@agramfort
Copy link
Member

agramfort commented Jul 15, 2017 via email

@balakmran
Copy link
Contributor Author

Added a comment.

@agramfort agramfort merged commit e3af9d0 into scikit-learn:master Jul 16, 2017
@agramfort
Copy link
Member

thx @bmanohar16

@balakmran balakmran deleted the pass_copy_to_preprocess_data branch July 16, 2017 15:17
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Aug 6, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
…cess_data (scikit-learn#9347)

* copy not passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case

* Pass copy as False for sparse matrix to _preprocess_data

* Add comment with reason for copy=False
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.

Should copy be passed from linear_model/base.py:_pre_fit to _preprocess_data in the sparse case?
3 participants