Skip to content

Unclear function documentation and warning #498

@ArlindKadra

Description

@ArlindKadra

def run_flow_on_task(flow, task, avoid_duplicate_runs=True, flow_tags=None,
seed=None, add_local_measures=True):
"""Run the model provided by the flow on the dataset defined by task.
Takes the flow and repeat information into account. In case a flow is not
yet published, it is published after executing the run (requires
internet connection).
Parameters
----------
model : sklearn model
A model which has a function fit(X,Y) and predict(X),
all supervised estimators of scikit learn follow this definition of a model [1]
[1](http://scikit-learn.org/stable/tutorial/statistical_inference/supervised_learning.html)
task : OpenMLTask
Task to perform. This may be an OpenMLFlow instead if the second argument is an OpenMLTask.
avoid_duplicate_runs : bool
If this flag is set to True, the run will throw an error if the
setup/task combination is already present on the server. Works only
if the flow is already published on the server. This feature requires an
internet connection.
This may be an OpenMLTask instead if the first argument is the OpenMLFlow.
flow_tags : list(str)
A list of tags that the flow should have at creation.
seed: int
Models that are not seeded will get this seed.
add_local_measures : bool
Determines whether to calculate a set of evaluation measures locally,
to later verify server behaviour. Defaults to True
Returns
-------
run : OpenMLRun
Result of the run.
"""
if flow_tags is not None and not isinstance(flow_tags, list):
raise ValueError("flow_tags should be list")
# TODO: At some point in the future do not allow for arguments in old order (order changed 6-2018).
if isinstance(flow, OpenMLTask) and isinstance(task, OpenMLFlow):
# We want to allow either order of argument (to avoid confusion).
warnings.warn("The old argument order (Flow, model) is deprecated and will not be supported in the future. "
"Please use the order (model, Flow).", DeprecationWarning)

I was checking out this function and it confused me.

model : sklearn model

There is no model parameter, there is a flow and it is an OpenMLFlow.
Task to perform. This may be an OpenMLFlow instead if the second argument is an OpenMLTask.

I am guessing it should be changed from second to first argument, as this is the second one ?
warnings.warn("The old argument order (Flow, model) is deprecated and will not be supported in the future. "
"Please use the order (model, Flow).", DeprecationWarning)

It seems wrong. It was OpenMLTask and OpenMLFlow, now it is reversed. The warning should display "It should be (flow, task) and not (task, flow) "?

If I understood things clearly, I can make a pull request with the minor changes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions