首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sklearn2pmml:试图保存PMMLPipeline时出错

sklearn2pmml:试图保存PMMLPipeline时出错
EN

Stack Overflow用户
提问于 2022-08-04 15:33:32
回答 1查看 156关注 0票数 0

我试图通过包CatboostClassifier保存一个sklearn2pmml模型:

代码语言:javascript
复制
pipeline = PMMLPipeline([
    ("model", CatBoostClassifier(...))])

pipeline.fit(...)


sklearn2pmml(pipeline, "path\pmml_object.pmml") 

不幸的是,这是我得到的错误:

代码语言:javascript
复制
Standard output is empty
Standard error:
Exception in thread "main" java.lang.IllegalArgumentException: The transformer object (Python class catboost.core.CatBoostClassifier) is not a supported Transformer
    at org.jpmml.python.CastFunction.apply(CastFunction.java:47)
    at sklearn.pipeline.Pipeline$1.apply(Pipeline.java:108)
    at sklearn.pipeline.Pipeline$1.apply(Pipeline.java:95)
    at com.google.common.collect.Lists$TransformingRandomAccessList.get(Lists.java:638)
    at sklearn2pmml.pipeline.PMMLPipeline.getHead(PMMLPipeline.java:629)
    at sklearn2pmml.pipeline.PMMLPipeline.encodePMML(PMMLPipeline.java:198)
    at com.sklearn2pmml.Main.run(Main.java:84)
    at com.sklearn2pmml.Main.main(Main.java:62)
Caused by: java.lang.ClassCastException: Cannot cast net.razorvine.pickle.objects.ClassDict to sklearn.Transformer
    at java.lang.Class.cast(Unknown Source)
    at org.jpmml.python.CastFunction.apply(CastFunction.java:45)
    ... 7 more

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-37-4da18df9921b> in <module>
----> 1 sklearn2pmml(pipeline, "path\pmml_object.pmml")

~\Anaconda3\lib\site-packages\sklearn2pmml\__init__.py in sklearn2pmml(pipeline, pmml, user_classpath, with_repr, debug)
    257                                 print("Standard error is empty")
    258                 if retcode:
--> 259                         raise RuntimeError("The SkLearn2PMML application has failed. The Java executable should have printed more information about the failure into its standard output and/or standard error streams")
    260         finally:
    261                 if debug:

RuntimeError: The SkLearn2PMML application has failed. The Java executable should have printed more information about the failure into its standard output and/or standard error streams

我试图搜索堆栈溢出,但没有找到确切的错误。

EN

回答 1

Stack Overflow用户

发布于 2022-09-15 06:31:36

尝试使用java_opts分配4gb内存,如下所示-

代码语言:javascript
复制
sklearn2pmml(pipeline, "path\pmml_object.pmml",java_opts=["-Xms4096m", "-Xmx4096m"])

如果内存错误仍然存在,请尝试增加gbs。希望这能有所帮助!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73238618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档