简体   繁体   中英

PMML sklearn2pmml error in python2.7

I have a randomforest model that I am trying to convert into a pmml. I could fit the model properly, as it doesn't throw any errors:

test_pipeline = PMMLPipeline([("rforest", RandomForestClassifier())])
test_pipeline.fit(trainX, trainY)

CPU times: user 1.18 s, sys: 61.6 ms, total: 1.24 s
Wall time: 1.25 s

However I get an error when I try to call the sklearn2pmml method:

sklearn2pmml(test_pipeline, "DecisionTreeIris.pmml", with_repr = True)

Error:

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
<ipython-input-38-9f07cfed11da> in <module>()
----> 1 sklearn2pmml(test_pipeline, "DecisionTreeIris.pmml", with_repr = True)

/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/__init__.pyc in sklearn2pmml(pipeline, pmml, user_classpath, with_repr, debug)
     89                 if(debug):
     90                         print(" ".join(cmd))
---> 91                 subprocess.check_call(cmd)
     92         finally:
     93                 if(debug):

/Users/dileeppatchigolla/anaconda/lib/python2.7/subprocess.pyc in check_call(*popenargs, **kwargs)
    539         if cmd is None:
    540             cmd = popenargs[0]
--> 541         raise CalledProcessError(retcode, cmd)
    542     return 0
    543 

CalledProcessError: Command '['java', '-cp', '/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/guava-19.0.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/istack-commons-runtime-2.21.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jaxb-core-2.2.11.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jaxb-runtime-2.2.11.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jcommander-1.48.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jpmml-converter-1.2.0.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jpmml-lightgbm-1.0.0.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jpmml-sklearn-1.2.3.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/jpmml-xgboost-1.1.4.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/pmml-agent-1.3.4.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/pmml-model-1.3.4.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/pmml-model-metro-1.3.4.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/pmml-schema-1.3.4.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/pyrolite-4.15.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/serpent-1.16.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/slf4j-api-1.7.22.jar:/Users/dileeppatchigolla/.local/lib/python2.7/site-packages/sklearn2pmml/resources/slf4j-jdk14-1.7.22.jar', 'org.jpmml.sklearn.Main', '--pkl-pipeline-input', '/var/folders/1j/5zzgmlk16ql5mm9z6_3n0c840000gp/T/pipeline-G164OK.pkl.z', '--repr-pipeline', "PMMLPipeline(steps=[('rforest', RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',\n            max_depth=None, max_features='auto', max_leaf_nodes=None,\n            min_samples_leaf=1, min_samples_split=2,\n            min_weight_fraction_leaf=0.0, n_estimators=10, n_jobs=1,\n            oob_score=False, random_state=None, verbose=0,\n            warm_start=False))])", '--pmml-output', 'DecisionTreeIris.pmml']' returned non-zero exit status 1

Can someone help me debug the error logs and provide a solution?

You appear to be accessing sklearn2pmml functionality from within IPython notebook. This function executes a Java process (as can be seen from the last line of your error report), and checks whether this Java process returns exit code 0 (success) or -1 (failure).

The most probable cause for returning exit code -1 is that some sort of Java exception was thrown. The Java process prints the full stack trace of such exceptions to its "standard" output stream. Apparently, the IPython notebook doesn't know how to capture and transmit it - you're only seeing Python's "front-end" exception, and not Java's "back-end" exception.

Your error report does not contain any actionable information (and is not a reproducible example). Please check the raw logs of your IPython notebook, and see what the Java "back-end" exception really was. What happens if you execute your Python script straight from the command-line?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM