How to add ModelStats tag or model statistics in a PMML file?

I have been exploring the possibilities of PMML with Knime. I have come across a very important tag inside a PMML file to expand the understandability of the training data and the model in a PMML file.

It is the <ModelStats> tag. More information about this tag is found here.


This tag is used to include various information about the training data like:

  • Mean, Std, Median, IQR
  • Min, Max
  • Frequency, Missing Freq, Invalid Freq
  • Count per category, per categorical column, etc.

Other model-related stats like:

  • Confidence interval
  • t-test value
  • p-value
  • degrees of freedom
  • Standard error


Now, I am not able to find a way with which I can include those in the PMML file. I am able to generate the descriptive stats like Mean, std etc listed in the 1st list above, with python using ContinuousDomain and CategoricalDomain but still unable to get other stats like those listed in the 2nd list.

What am I asking is…

To find a way to include such stats (from 1st list and 2nd) in the PMML with KNIME. Is there any way? How to do that?

Please guide. Thank you.

Hello @aayushsmarten,

you can calculate the model-related metrics from your second list directly within KNIME for example with the One-way ANOVA – KNIME Hub node or the Single sample t-test – KNIME Hub node.
The more difficult part will be to adapt the PMML file. Have you tried to use the XML To PMML – KNIME Hub node?

Best regards

Hello @JoergWas,
Thanks for the reply, I have tried using XML to PMML node in the following way:

Am not much sure… but I am getting the error like that. The reason I am using Cell to PMML node is because we want the blue output node to write the PMML, Right?

What is going wrong? And also in the XML to PMML there is a little warning sign even after the execution of the node. That tells that one of the nodes is not successfully executed.

But in the Column to XML node… the situation is like

Any idea? Thanks!!