Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi all,
we'd need to automatically change the dates related to the split between train and test of a visual ML model.
So far we've been able to get the raw details of the split via code similar to the following:
...
client = dataiku.api_client()
current_project = client.get_default_project()
my_model = current_project.get_ml_task('myAnalysisID', 'myTaskId')
split_params = my_model.get_settings().get_split_params().get_raw()
We then would need to change the values of a couple of dates in order to reflect a new split, but we are stuck here.
It seems we would need to use the class dataikuapi.dss.utils.DSSFilterBuilder, but we cannot find anywhere a reference on how to initialize nor to use it. Any ideas/suggestions ?
Thanks for your help. Best Regards.
Giuseppe
P.S.: we would like to keep the visual analysis rather than translating everything into a Python recipe.
Hi,
For updating an existing filter, it's easier, you can access the current definition of the filter in:
split_params.get_raw()["efsdTrain"]["filter"]["uiData"]
Ditto for "efsdTest".
"efsdTrain/efsdTest" are used for "Explicit Filter Single Dataset". If you are using "Explicit Filter Two Datasets", you need to use "eftdTrain" and "eftdTest"
For example, a "Pclass contains 1" filter translates to this value for uiData:
{
"mode": "&&",
"conditions": [
{
"input": "Pclass",
"operator": "contains",
"string": "1"
}
]
}
So switching that to "2" would be:
settings = mltask.get_settings()
split_params = settings.get_split_params()
split_params.get_raw()["efsdTrain"]["filter"]["uiData"]["conditions"][0]["string"] = "2"
settings.save()
Hope this helps
Hi,
For updating an existing filter, it's easier, you can access the current definition of the filter in:
split_params.get_raw()["efsdTrain"]["filter"]["uiData"]
Ditto for "efsdTest".
"efsdTrain/efsdTest" are used for "Explicit Filter Single Dataset". If you are using "Explicit Filter Two Datasets", you need to use "eftdTrain" and "eftdTest"
For example, a "Pclass contains 1" filter translates to this value for uiData:
{
"mode": "&&",
"conditions": [
{
"input": "Pclass",
"operator": "contains",
"string": "1"
}
]
}
So switching that to "2" would be:
settings = mltask.get_settings()
split_params = settings.get_split_params()
split_params.get_raw()["efsdTrain"]["filter"]["uiData"]["conditions"][0]["string"] = "2"
settings.save()
Hope this helps
Hi Clémemt,
thanks for the quick reply. Best Regards.
Giuseppe