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

Style improvements to least_angle.py #11703

Merged
merged 8 commits into from
Aug 6, 2018
Merged

Style improvements to least_angle.py #11703

merged 8 commits into from
Aug 6, 2018

Conversation

yukuairoy
Copy link
Contributor

What does this implement/fix? Explain your changes.

This fixes/improves the style of least_angle.py and its test test_least_angle.py.

@@ -196,7 +196,7 @@ def lars_path(X, y, Xy=None, Gram=None, max_iter=500,

if verbose:
if verbose > 1:
print("Step\t\tAdded\t\tDropped\t\tActive set size\t\tC")
print('Step\t\tAdded\t\tDropped\t\tActive set size\t\tC')
Copy link
Member

Choose a reason for hiding this comment

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

On what basis is this a worthwhile change?

Please don't waste reviewers' time on conforming to a personal preference.

Such changes may also introduce merge conflicts to other substantive pull requests.

Copy link
Contributor Author

@yukuairoy yukuairoy Jul 29, 2018

Choose a reason for hiding this comment

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

@jnothman Thanks for looking at this PR. The goal of this change certainly isn't to waste a reviewer's time!

I don't have a preference between single quotes and double quotes but I follow Google Style Guide's recommendation to "be consistent with your choice of string quote character within a file" (https://github.com/google/styleguide/blob/gh-pages/pyguide.md#310-strings). Since there are more places in this module that uses ' than " I converted those double quotes to single quotes. Of course the Google Style Guide isn't as well accepted as PEP8 which only recommends "Pick a rule and stick to it." So what's the rule here?

@jnothman
Copy link
Member

jnothman commented Jul 30, 2018 via email

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

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

Honestly most of these changes (except the ones I marked as OK) are cosmetic. We don't tend to accept such PRs as they require reviews and time for little added value. Also unless there is CIs testing for style as we have with flake8 someone is likely to revert these changes. So I am -1 for the PR as it is. Hope you can understand our reasons.

@@ -606,7 +606,8 @@ def __init__(self, fit_intercept=True, verbose=False, normalize=True,
self.copy_X = copy_X
self.fit_path = fit_path

def _get_gram(self, precompute, X, y):
@staticmethod
def _get_gram(precompute, X, y):
Copy link
Member

Choose a reason for hiding this comment

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

ok with this change.

X, y = diabetes.data, diabetes.target
G = np.dot(X.T, X)
Xy = np.dot(X.T, y)
for method in 'lar', 'lasso':
Copy link
Member

Choose a reason for hiding this comment

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

ok with this change.

@yukuairoy
Copy link
Contributor Author

@agramfort I reverted other changes except for the ones you okay-ed.

@agramfort agramfort merged commit 7ba7a4a into scikit-learn:master Aug 6, 2018
@agramfort
Copy link
Member

thx @yukuairoy

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