Skip to content

check if model is paralizable#230

Merged
janvanrijn merged 6 commits intodevelopfrom
fix229
Apr 25, 2017
Merged

check if model is paralizable#230
janvanrijn merged 6 commits intodevelopfrom
fix229

Conversation

@janvanrijn
Copy link
Copy Markdown
Member

No description provided.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Apr 21, 2017

Codecov Report

Merging #230 into develop will increase coverage by 0.01%.
The diff coverage is 92.3%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #230      +/-   ##
===========================================
+ Coverage    88.16%   88.18%   +0.01%     
===========================================
  Files           23       23              
  Lines         1884     1904      +20     
===========================================
+ Hits          1661     1679      +18     
- Misses         223      225       +2
Impacted Files Coverage Δ
openml/flows/__init__.py 100% <100%> (ø) ⬆️
openml/runs/functions.py 82.91% <100%> (+0.06%) ⬆️
openml/flows/sklearn_converter.py 92.68% <89.47%> (-0.2%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 058cfa1...239bf41. Read the comment docs.

Comment thread openml/flows/sklearn_converter.py Outdated

return ret

def model_single_core(model):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe call this _check_n_jobs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure.

print('Warning! Using subclass BaseSearchCV other than ' \
'{GridSearchCV, RandomizedSearchCV}. Should implement param check. ')
pass

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One newline is enough ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

K.

Comment thread openml/flows/sklearn_converter.py Outdated
isinstance(model, sklearn.model_selection._search.BaseSearchCV)):
raise ValueError('model should be BaseEstimator or BaseSearchCV')

# check if the njobs is not in the optimization trace
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think you want to say: make sure that n_jobs is not in the parameter grid.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

k

Comment thread openml/flows/sklearn_converter.py Outdated
'optimize the n_jobs parameter.')

# check the parameters for n_jobs
if check(model.get_params(), False) == False:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You coud do return check(model.get_params(), False)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure.

Comment thread openml/flows/__init__.py Outdated

__all__ = ['OpenMLFlow', 'create_flow_from_model', 'get_flow', 'list_flows',
'sklearn_to_flow', 'flow_to_sklearn', 'flow_exists']
'sklearn_to_flow', 'flow_to_sklearn', 'flow_exists', 'model_is_paralizable']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is model_is_paralizable?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My bad. Removed it

sklearn.ensemble.RandomForestClassifier(n_jobs=5),
sklearn.ensemble.RandomForestClassifier(n_jobs=-1),
sklearn.pipeline.Pipeline(steps=[('bag', sklearn.ensemble.BaggingClassifier(n_jobs=1))]),
sklearn.pipeline.Pipeline(steps=[('bag', sklearn.ensemble.BaggingClassifier(n_jobs=5))]),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't that fail because n_jobs > 1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same as previous

sklearn.ensemble.RandomForestClassifier(n_jobs=-1),
sklearn.pipeline.Pipeline(steps=[('bag', sklearn.ensemble.BaggingClassifier(n_jobs=1))]),
sklearn.pipeline.Pipeline(steps=[('bag', sklearn.ensemble.BaggingClassifier(n_jobs=5))]),
sklearn.pipeline.Pipeline(steps=[('bag', sklearn.ensemble.BaggingClassifier(n_jobs=-1))]),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't that fail because n_jobs < 0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same as previous

legal_models = [
sklearn.ensemble.RandomForestClassifier(),
sklearn.ensemble.RandomForestClassifier(n_jobs=5),
sklearn.ensemble.RandomForestClassifier(n_jobs=-1),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't that fail because n_jobs < 0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same as previous


legal_models = [
sklearn.ensemble.RandomForestClassifier(),
sklearn.ensemble.RandomForestClassifier(n_jobs=5),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't that fail because n_jobs > 1?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, this is exactly what happens, and this is specified in the answers array. Legal means here 'will not raise an error'. i added comments to make this more clear

sklearn.model_selection.GridSearchCV(multicore_bagging, illegal_param_dist)
]

answers = [True, False, False, True, False, False, True, False]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, here it's obvious what you're doing. Maybe you can re-order the test to make it easier to comprehend (i.e. check the legal models before declaring the illegal models, and maybe giving the list a different name.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added some comments

@janvanrijn janvanrijn merged commit 9a0d9a8 into develop Apr 25, 2017
@janvanrijn janvanrijn deleted the fix229 branch April 25, 2017 14:58
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