-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Conform to PEP8 standards #421
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
Conversation
|
This will take a while to review, but let's try to get this merged ASAP so it doesn't slow down other development efforts. @weixuanfu2016, can you please take a look in the next day or two to see if you find any issues? I will plan to do so as well. |
|
OK, will do |
tests.py
Outdated
|
|
||
| """Assert that the TPOTClassifier score function outputs a known score for a fix pipeline.""" | ||
| tpot_obj = TPOTClassifier() | ||
| known_score = 0.977777777778 # Assumes use of the TPOT balanced_accuracy function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May need to delete or update this comment since the default scoring function is accuracy instead of balanced_accuracy
tpot/driver.py
Outdated
| tpot_type = TPOTClassifier | ||
| else: | ||
| tpot_type = TPOTRegressor | ||
| def _impute_missing_values(features, missing_value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that this imputation function could also be added into interactive mode by moving it to base.py
|
Oops. the imputation function was mistakenly left in. I'll remove that and
update the PR.
|
tpot/driver.py
Outdated
|
|
||
| if args.VERBOSITY in [1, 2] and tpot._optimized_pipeline: | ||
| training_score = max([tpot._pareto_front.keys[x].wvalues[1] for x in range(len(tpot._pareto_front.keys))]) | ||
| if args.VERBOSITY < 3 and tpot._optimized_pipeline: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here need to be [1, 2] for no stdout when verbosity=0
tpot/gp_deap.py
Outdated
| ind_str = str(ind1) | ||
| num_loop = 0 | ||
| while ind_str == str(ind1) and num_loop < 50 : # 50 loops at most to generate a different individual by crossover | ||
| while ind_str == str(ind1) and num_loop < 50: # 50 loops at most to generate a different individual by crossover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May also use NUM_TESTS instead as decorators.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, might as well get rid of the magic numbers from DEAP.
tests.py
Outdated
|
|
||
|
|
||
| # http://stackoverflow.com/questions/5595425/ | ||
| def is_close(a, b, rel_tol=1e-09, abs_tol=0.0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use numpy.allclose here: https://docs.scipy.org/doc/numpy/reference/generated/numpy.allclose.html
| testing_features.astype(np.float64), | ||
| testing_classes.astype(np.float64) | ||
| ) | ||
| return abs(score) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is returning abs of the score the correct thing to do here? The blame graph shows that we added it when we added regressors, but what is the thinking behind it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC some scorers produce scores in the range [0, ∞), but the regressors can have scores in the range (-∞, ∞).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll file a separate issue for this topic since it's not particularly related to this PR.
tpot/built_in_operators.py
Outdated
|
|
||
| @property | ||
| def __name__(self): | ||
| """Instance ame is the same as the class name.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here: ame
|
|
||
| 'sklearn.feature_selection.SelectKBest': { | ||
| 'k': range(1, 100), # need check range! | ||
| 'k': range(1, 100), # TODO: Check range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@weixuanfu2016, please file an issue for this TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
|
OK. After the two issues I mentioned above are settled, I'm 👍 on merging. |
|
Hold on, ignore that commit. I'm going to remove something and rebase. |
tpot/base.py
Outdated
| file_string = input_file.read() | ||
| self.config_dict = eval(file_string[file_string.find('{'):(file_string.rfind('}') + 1)]) | ||
| config_module = import_module(config_dict) | ||
| self.config_dict = config_module.tpot_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change intended? I thought this was a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully that doesn't change too much. :-) My only gripe is this new functionality here.
|
PR looks good to merge. Any outstanding issue before I merge it? |
|
Don't think so. Merge away |
What does this PR do?