PMML Reader Issue "not a valid PMML 4.2 file"

python
#1

Hi,
I’m trying to validate a model I created using the Python Learner Node. Within this node, I wrote the model to PMML and saved to a directory. I used the Nyoka library in Python to write the PMML. I’ve been trying to import the PMML to a new workflow to validate the model, but I’m getting the error “not a valid PMML 4.2 file”. The PMML has been saved as version 4.3, but I’ve read on another question on this forum that Knime implicitly converts the version (Converting between PMML versions).
Is my method of writing the PMML to file within the Python Learner Node incorrect and causing the not Valid issue? Is the there an alternative method of writing a Python Model to PMML?

0 Likes

#2

Hi,
as far as I know, only PMML documents of a version less than 4.2 are converted. Depending on the model you use, you may be able to get it to work by simply changing the 4.3 to a 4.2 in the PMML document. Between 4.2 and 4.3 only some more model types were added. If you don’t use those, KNIME should understand the PMML.
Kind regards
Alexander

1 Like

#3

Hi Alexander,
I tried your suggestion but had no success. I’m writing a XGBoost model to pmml through Python. Knime currently doesn’t appear to have the capability of writing this model to pmml using knime nodes, so maybe this is also contributing to it not working?
I know that the H2O integration can write Xgboost to MOJO, but unfortunately for other separate reasons I can’t use this method right now.
Instead, I am writing the model using the Python Object writer & reader nodes and validating the model this way, but I prefer to be able to test the pmml as this is what I will be passing to the the Java Developer

0 Likes

#4

Hi,
I also suspect that KNIME cannot handle XGBoost Models in PMML. Could you send me the PMML file so I can have a look?
Kind regards
Alexander

0 Likes