Skip to content

[MRG] Support for ColumnTransformer - #523

Merged
mfeurer merged 21 commits into
developfrom
add_#494
Sep 28, 2018
Merged

mfeurer merged 21 commits into
developfrom
add_#494

Conversation

@janvanrijn

Copy link
Copy Markdown
Member

Reference Issue

What does this PR implement/fix? Explain your changes.

How should this PR be tested?

Any other comments?

@janvanrijn
janvanrijn changed the base branch from master to develop September 13, 2018 18:32
@mfeurer mfeurer closed this Sep 20, 2018
@mfeurer mfeurer reopened this Sep 20, 2018
@codecov-io

codecov-io commented Sep 21, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #523 into develop will decrease coverage by 0.76%.
The diff coverage is 76.47%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #523      +/-   ##
===========================================
- Coverage    90.65%   89.88%   -0.77%     
===========================================
  Files           32       32              
  Lines         2996     2858     -138     
===========================================
- Hits          2716     2569     -147     
- Misses         280      289       +9
Impacted Files Coverage Δ
openml/runs/run.py 89.45% <100%> (-1.37%) ⬇️
openml/flows/sklearn_converter.py 91.64% <71.42%> (-3.43%) ⬇️

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 460361c...04279d5. Read the comment docs.

@janvanrijn janvanrijn changed the title [WIP] Support for ColumnTransformer [MRG] Support for ColumnTransformer Sep 21, 2018
@janvanrijn
janvanrijn requested a review from mfeurer September 27, 2018 15:11
@janvanrijn

Copy link
Copy Markdown
Member Author

@mfeurer Finally I got the PEP8 stuff fixed, can we merge before it breaks again? ;)

@mfeurer mfeurer left a comment

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.

This looks great. I only have very minor change requests/questions.

Comment thread tests/test_runs/test_run_functions.py Outdated
('dummy', DummyClassifier(strategy='prior'))])
self._run_and_upload(pipeline1, '62501')

@pytest.mark.skipif(LooseVersion(sklearn.__version__) < "0.20",

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.

Is there a reason to use a method from pytest here instead of the respective one from unittest?

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.

It was my understanding that unittest is no longer supported and that we move to pytest? Correct me if I am wrong

@mfeurer mfeurer Sep 28, 2018 •

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.

No, it's actually nosetests which got deprecated, unittest is a standard module (with somewhat limited functionality, that's we used nose and now use pytest).

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.

Cool, I replaced them.

Comment thread openml/flows/sklearn_converter.py Outdated
if not isinstance(sub_component, (OpenMLFlow, type(None))):
msg = 'Second item of tuple does not match assumptions. '\
'Expected OpenMLFlow, got %s' % type(sub_component)
raise ValueError(msg)

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.

Could you please make this a TypeError?

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/sklearn_converter.py Outdated
cr_value['key'] = identifier
cr_value['step_name'] = identifier
if len(sub_component_tuple) == 3:
cr_value['param_1'] = sub_component_tuple[2]

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.

Should we maybe rename param_1 into argument_1 to as this is (in my opinion) rather an argument to that specific step of the pipeline than a parameter (or hyperparameter).

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/runs/run.py
if not isinstance(_tmp, (list, tuple)):
raise e
for step_name, step in _tmp:
for _temp_step in _tmp:

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 we should also add some checks/safeguards that the third argument is not an instance of OpenMLFlow? Meybe this piece of code can be generalized to check all elements in that list?

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 checks for all 3 parts of the tuple

Comment thread tests/test_flows/test_sklearn.py Outdated
self.assertEqual(new_model_params, fu_params)
new_model.fit(self.X, self.y)

@pytest.mark.skipif(LooseVersion(sklearn.__version__) < "0.20",

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.

Please see comment below.

Comment thread tests/test_flows/test_sklearn.py Outdated
serialization2 = sklearn_to_flow(new_model)
assert_flows_equal(serialization, serialization2)

@pytest.mark.skipif(LooseVersion(sklearn.__version__) < "0.20",

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.

Here too.

@mfeurer

mfeurer commented Sep 28, 2018

Copy link
Copy Markdown
Collaborator

Awesome!

@mfeurer
mfeurer merged commit d5ca1d1 into develop Sep 28, 2018
@mfeurer
mfeurer deleted the add_#494 branch September 28, 2018 12:29
@janvanrijn

Copy link
Copy Markdown
Member Author

This is really great, from my POV we are ready to release now (although merging #482 would be great)

@amueller

amueller commented Oct 4, 2018

Copy link
Copy Markdown
Contributor

sweet :)

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.

4 participants