Skip to content

Conversation

@sahithyaravi
Copy link
Member

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

add a list_evaluations_setups call that merges list_evaluations with list_setups and returns a list of evaluations with hyperparameters.

How should this PR be tested?

evaluations.list_evaluations_setups(function=function,flow=[flow_id], sort_order=sort_order,size=size, output_format='dataframe')

Any other comments?

list_evaluations has been modified. This is because the existing conversion to dataframe format does not preserve row order (even if ordered dict is passed - bug in pandas). So dataframe conversion is now performed by using a loop over all rows and collecting them in a list.

@codecov-io
Copy link

codecov-io commented Jul 24, 2019

Codecov Report

Merging #747 into develop will decrease coverage by 0.05%.
The diff coverage is 92.59%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #747      +/-   ##
===========================================
- Coverage    87.97%   87.91%   -0.06%     
===========================================
  Files           36       36              
  Lines         4090     4114      +24     
===========================================
+ Hits          3598     3617      +19     
- Misses         492      497       +5
Impacted Files Coverage Δ
openml/evaluations/__init__.py 100% <100%> (ø) ⬆️
openml/evaluations/functions.py 92.3% <92%> (+2.75%) ⬆️
openml/exceptions.py 84.37% <0%> (-9.38%) ⬇️
openml/_api_calls.py 83.11% <0%> (-1.3%) ⬇️
openml/runs/functions.py 81.79% <0%> (-0.29%) ⬇️

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 e6ee09d...1065264. Read the comment docs.

# Conflicts:
#	doc/progress.rst
#	tests/test_flows/test_flow_functions.py
@sahithyaravi sahithyaravi requested a review from mfeurer July 29, 2019 12:03
@unittest.skipIf(LooseVersion(sklearn.__version__) == "0.19.1",
reason="Target flow is from sklearn 0.19.1")
def test_get_flow_reinstantiate_model_wrong_version(self):
openml.config.server = self.production_server
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is code was re-introduced in your merge, please remove it.

openml.config.server = self.production_server
flow_id = 405
size = 100
evals_setups = openml.evaluations.list_evaluations_setups("predictive_accuracy",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know we're generally not very good at code re-use, particularly in unit tests, but I'd rather change that :) Please extract the common code between test_list_evaluations_setups_filter_flow and test_list_evaluations_setups_filter_task into one function that is called from both tests (e.g. specifying either flow=[flow_id] or task=[task_id] through **kwargs).

# Check if list is non-empty
self.assertGreater(len(evals_setups), 0)
# Check if output from sort is sorted in the right order
self.assertTrue(sorted(list(evals_setups['value'].values), reverse=True)
Copy link
Collaborator

@PGijsbers PGijsbers Jul 30, 2019

Choose a reason for hiding this comment

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

Please use assertEqual for equality checks. Edit: actually, as you're checking sequence equality, use assertSequenceEquals.

self.assertTrue(sorted(list(evals_setups['value'].values), reverse=True)
== list(evals_setups['value'].values))
# Check if output and order of list_evaluations is preserved
self.assertTrue((evals_setups['run_id'].values == evals['run_id'].values).all())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use assertSequenceEquals, but you will also need to first use tolist

Copy link
Collaborator

@PGijsbers PGijsbers left a comment

Choose a reason for hiding this comment

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

Looks good, some minor code quality changes suggested. I think we could look into adding the hyperparameters as columns if a flow filter is applied, but perhaps that's something for a different PR?

@sahithyaravi
Copy link
Member Author

ted. I think we could look into adding the hyperparameters as columns if a flow filter is applied, but perhaps that's something for a different PR?

A new column to the list_evaluations call? I am not sure if that is needed now that we have this new call, and I believe it may be better to do it in a different PR.

@PGijsbers
Copy link
Collaborator

To the returned dataframe of list_evaluations_setups. If a single flow is selected, the hyperparameters are always the same, so we can have a dataframe which specifies each hyperparameter value by column, rather than one column which contains a dictionary of parameter values. But I'll ignore the idea for this PR.

@PGijsbers PGijsbers merged commit 91be1ac into develop Aug 5, 2019
@PGijsbers PGijsbers deleted the add_#737 branch August 5, 2019 07:34
@sahithyaravi sahithyaravi mentioned this pull request Aug 22, 2019
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