Can't get the predictor from a clustering model handler using the python API

Solved!
Antal
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

0 Kudos
1 Solution
SarinaS
Dataiker

Hi @Antal,

You can use get_predictor() on clustering models starting in DSS 11.1! Here is an example: 

Screen Shot 2023-01-03 at 5.40.01 PM.png

I would suggest upgrading to the latest release if you are able to.

Thanks,
Sarinaโ€ƒ

View solution in original post

0 Kudos
2 Replies
SarinaS
Dataiker

Hi @Antal,

You can use get_predictor() on clustering models starting in DSS 11.1! Here is an example: 

Screen Shot 2023-01-03 at 5.40.01 PM.png

I would suggest upgrading to the latest release if you are able to.

Thanks,
Sarinaโ€ƒ

0 Kudos
Antal
Author

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!

0 Kudos

Labels

?
Labels (3)
A banner prompting to get Dataiku