How to aggregate a segment wise decision tree model and create PMML output

Hello, I have created aa segmentwise model in Knime and want to export it as a PMML model. what step shoudl i take

Hi @munisharora

Welcome to KNIME forum. From your input it looks like your are running multiple models within your loop. A little bit of topic is the question if it’s a good strategy to run all your models with the same parameters in your Decision Tree node?
But anyway it’s possible to write a pmml every run of your loop. See the picture for the modifications you have to make.


With the String Manipulation (Variable) node you create a location and a file name for your PMML file. The code for this node is something like this
join("/home/hans/Downloads/",$${Varname_from_table_row_to_variable_start}$$,".pmml")
In the PMML writer you use the created varname as flow variable.
pmml2

So for every row created in your GroupBy node you will have a PMML file .

Or if your objective is to have PMML ensemble your workflow can look like this

gr. Hans

3 Likes

Great. Would it be possible to attach your sample workflow. That would make it easier to understand and reproduce your suggestions. Thanks.

Hi @mlauber71

Here are both workflows pmml.knwf (293.5 KB) pmml_ensemble.knwf (256.3 KB). I created them from a functional perspective. I did not pay any attention to the modelling part.

gr, Hans

1 Like

Thank you for suggestion. I had tried the ensemble loop end but It throws error. The idea is to get a single PMML output that combines model for all segments.

Just on side note, segmentwise models for the same genre of data is a common use-case where initial input parameters a full spectrum of attributes, the tree outputs however are different as each model may give importance o a different variable. It’s like if u are building a claims fraud model for United States and want each fraud model to be state specific, then statecode field becomes the groupby before table row to variable loop. And filter only sends data for a single state, but at the end I want single PMML file that automatically unions all models and depending upon the input statecode, applies appropriate model. A lot of the data wrangling occurred beforehand to make sure the samples are large enough, random and representative .

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.