0

I'm trying to create a PMML from a model, using this way :

from sklearn.preprocessing import LabelEncoder
y_h_train = LabelEncoder().fit_transform(y_train.copy(deep=True))

modele_label_encoded = model.fit(X_train, y_h_train)



import sklearn2pmml as skpmml
from sklearn2pmml import PMMLPipeline, sklearn2pmml

cols_used = list(X_train.columns)
pmml_model = skpmml.make_pmml_pipeline(modele_label_encoded)
pmml_model.active_fields = cols_used
pmml_model.target_fields = ['Traget']
skpmml.sklearn2pmml(pmml_model, os.path.join('test.pmml'), debug=True)

And the PMML seems not to understand the classes_ :

Exception in thread "main" java.lang.IllegalArgumentException: The value of 'xgboost.sklearn.XGBClassifier.classes_' attribute (null) is not a supported array type

I don't understand the error since my classes_ has an array type, as requested :

modele_label_encoded.classes_
Output : array([0, 1])

I found no post about this error, does someone know how to solve it?

1

1 Answer 1

0

Question answered here : https://github.com/jpmml/sklearn2pmml/issues/466

TLDR : Version of sklearn2pmml is too old. Find in their github the file requirements.txt of your version of sklearn2pmml, and adapt all other libraries to the ones on the file

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.