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

Skip to content

Conversation

@pakallis
Copy link
Contributor

@pakallis pakallis commented Jan 3, 2019

What does this implement/fix? Explain your changes.

This is a minor refactoring to simplify the code that lives in method fit. No functionality was added

  • Extract refit_metric assignment to private method _get_refit_metric to
    simplify complexity of fit
  • Remove unneeded else statements inside _get_refit_metric

Any other comments?

The method fit is too complex in my opinion. This is a step to simplify it.
The removal of else statements improves readability and complex if...else logic

Any ideas on how to simplify this method/logic further?

- Extract refit_metric assigment to private method _get_refit_metric to
simplify complexity of `fit`
- Remove unneeded `else` statements inside _get_refit_metric
Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

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

I don't mind this kind of refactor personally, although the style convention here does tend towards long functions. However, I'd rather avoid a merge conflict with #11354. Perhaps we should suggest a similar refactoring happens over there.

if not self.multimetric_:
return 'score'

if self.refit is not False and (
Copy link
Member

Choose a reason for hiding this comment

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

if we negate this condition and return, the code might be simpler.

if not self.multimetric_:
return 'score'

if self.refit is not False and (
Copy link
Member

Choose a reason for hiding this comment

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

if we negate this condition and return, the code might be simpler.

@pakallis
Copy link
Contributor Author

pakallis commented Jan 6, 2019

@jnothman As i wasn't aware of #11354, I will close this pull request and suggest the changes in #11354 to avoid conflicts. Thanks for pointing out

@pakallis pakallis closed this Jan 6, 2019
@pakallis pakallis deleted the minor-refactoring-refit-metric branch January 6, 2019 21:37
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.

2 participants