pythonscikit-learnruntime-errorpython-3.8pmml

Calling the sklearn2pmml() function in Python 3.8 throws RuntimeError


I'am trying to save my scikit learn logistic regression as pmml but get a RuntimeError:

My code:

from sklearn2pmml import sklearn2pmml
from sklearn2pmml.pipeline import PMMLPipeline
from sklearn.linear_model import LogisticRegression

pipe_pmml = PMMLPipeline(steps=[('mapper', mapper),
                                ('estimator', LogisticRegression(C = 0.01, 
                                  penalty = 'l1', 
                                  solver = 'liblinear', 
                                  random_state = 1))
                                ])
pipe_pmml.fit(X_small, y)

sklearn2pmml(pipe_pmml, pmml_filename, with_repr = True)

with error:

Standard output is empty
Standard error:
Exception in thread "main" net.razorvine.pickle.InvalidOpcodeException: invalid pickle opcode: 0
    at net.razorvine.pickle.Unpickler.dispatch(Unpickler.java:366)
    at org.jpmml.python.CustomUnpickler.dispatch(CustomUnpickler.java:31)
    at org.jpmml.python.PickleUtil$1.dispatch(PickleUtil.java:64)
    at net.razorvine.pickle.Unpickler.load(Unpickler.java:109)
    at org.jpmml.python.PickleUtil.unpickle(PickleUtil.java:85)
    at com.sklearn2pmml.Main.run(Main.java:78)
    at com.sklearn2pmml.Main.main(Main.java:6

where mapper is a DataFrameMapper from sklearn_pandas

Anybody any idea?


Solution

  • Solution: Downgrade joblib to 1.1.0

    see: https://github.com/jpmml/jpmml-python/issues/19