PMML Predictor: Add Class Probabilities

Hi,

I want to execute a stored PMML previously stored in a  file (the PMML contains a normalization and learned SVM Model), and have "predicted class" and "class probabilities" as output. Input is json (it is converted to table; want to use the Rest API later).

Everything until the model execution works fine.

Then, following problem choosing the Predictor Node:

1) If I use the "PMML Predictor", it executes ok, but this does not give class probabilities. 

2) If I use the "SVM Predictor", I am getting a "DataSpec generated by configure does not match spec after execution." error. I checked if training data  and the input data (json to table) have the same columns - the training data for SVM has got 14 input var columns+target variable column; the (json to table) has the same 14 input columns (used a "extract column header"+"csv writer" to have the same column names). The output values seem wrong - e.g. class probability is exactly 0.5 for both classes - this is different to the same input training values...

Please see the attachment for more details (contains both 1+2).

Can you please help me how to get the Workflow running with  "predicted class" and "class probabilities"?

Thanks!

 

Best Regards

Florian

Hi Florian,

this looks like there is something wrong, especially because the PMML Predictor only checks the type of PMML model and then should call the SVM Predictor anyways, so it is strange that they behave differently. Would you mind sharing your PMML file so I can check it on my machine?

Regards,

Alexander

image

Hello, I have a similar question above is there way to get the class probabilities when using a custom ensemble model in KNIME? When trying to obtain the class probabilities in the configuration portion of Compiled Model Predictor it does not appear even if I check it off. I pasted a snap shot of my workflow thanks in advance!

@arianiherrera not types of models support class probabilities with PMML (I am not aware of any changes since then):

You could try and build a workflow with

This does support probabilities. You might have to toy around to make it work. Currently there is no example workflow on the hub - which corresponds with my recollection that this is not that easy to set up.

1 Like