Skip to content

Commit 83c0c10

Browse files
committed
addedfunction to tag flows on run time #214
1 parent 588ffbf commit 83c0c10

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

openml/runs/functions.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525

26-
def run_task(task, model):
26+
def run_task(task, model, flow_tags=[]):
2727
"""Performs a CV run on the dataset of the given task, using the split.
2828
2929
Parameters
@@ -34,17 +34,22 @@ def run_task(task, model):
3434
a model which has a function fit(X,Y) and predict(X),
3535
all supervised estimators of scikit learn follow this definition of a model [1]
3636
[1](http://scikit-learn.org/stable/tutorial/statistical_inference/supervised_learning.html)
37-
37+
flow_tags : list(str)
38+
a list of tags that the flow should have at creation
3839
3940
Returns
4041
-------
4142
run : OpenMLRun
4243
Result of the run.
4344
"""
45+
if not isinstance(flow_tags, list):
46+
raise ValueError("flow_tags should be list")
4447
# TODO move this into its onwn module. While it somehow belongs here, it
4548
# adds quite a lot of functionality which is better suited in other places!
4649
# TODO why doesn't this accept a flow as input? - this would make this more flexible!
4750
flow = sklearn_to_flow(model)
51+
flow.tags = flow_tags
52+
# TODO: also tag the flow if it already exists
4853
flow_id = flow._ensure_flow_exists()
4954
if flow_id < 0:
5055
print("No flow")

0 commit comments

Comments
 (0)