Can't get the predictor from a clustering model handler using the python API
I've been having success manipulating saved models using the python public API for both prediction and classification models to get more information from them and use the predictors in recipes.
But I'm having trouble doing the same with clustering models trained in VisualML and deployed to the flow.
I usually do
import dataiku model = dataiku.Model("model_id") predictor = model.get_predictor()
But with clustering models, I get an error.
If I look at
model._predictors
I also see a result of only
{}
It seems some parameter set is missing from the clustering model object to succesfully run the get_predictor() method. Is there another way that I can extract the sklearn predictor from a VisualML clustering model using the python API?
Operating system used: Windows 10
Best Answer
-
Sarina Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 317 Dataiker
Hi @Antal
,
You can use get_predictor() on clustering models starting in DSS 11.1! Here is an example:I would suggest upgrading to the latest release if you are able to.
Thanks,
Sarina
Answers
-
Antal Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 88 Neuron
Hi Sarina,
That's great news!
I was working on a workaround by loading the clusterer.pkl from the model directory on disk. But I had quite some trouble trying to reconstruct the data preprocessing scripts.
Having a get_predictor() method is so much easier!