Attribute ‘sklearn.linear_model._logistic.LogisticRegression.multi_class‘ must be explicitly set to
生活随笔
收集整理的這篇文章主要介紹了
Attribute ‘sklearn.linear_model._logistic.LogisticRegression.multi_class‘ must be explicitly set to
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
試圖python模型轉化為java加載,碰到個硬茬,完整報錯信息如下:
Jul 13, 2020 3:13:45 PM org.jpmml.sklearn.Main run INFO: Parsing PKL.. Jul 13, 2020 3:13:45 PM org.jpmml.sklearn.Main run INFO: Parsed PKL in 14 ms. Jul 13, 2020 3:13:45 PM org.jpmml.sklearn.Main run INFO: Converting.. Jul 13, 2020 3:13:45 PM sklearn2pmml.pipeline.PMMLPipeline initTargetFields WARNING: Attribute 'sklearn2pmml.pipeline.PMMLPipeline.target_fields' is not set. Assuming y as the name of the target field Jul 13, 2020 3:13:45 PM sklearn2pmml.pipeline.PMMLPipeline initActiveFields WARNING: Attribute 'sklearn2pmml.pipeline.PMMLPipeline.active_fields' is not set. Assuming [x1, x2, x3, x4] as the names of active fields Jul 13, 2020 3:13:45 PM org.jpmml.sklearn.Main run SEVERE: Failed to convert java.lang.IllegalArgumentException: Attribute 'sklearn.linear_model._logistic.LogisticRegression.multi_class' must be explicitly set to the 'ovr' or 'multinomial' valueat sklearn.linear_model.logistic.LogisticRegression.encodeModel(LogisticRegression.java:57)at sklearn2pmml.pipeline.PMMLPipeline.encodePMML(PMMLPipeline.java:231)at org.jpmml.sklearn.Main.run(Main.java:233)at org.jpmml.sklearn.Main.main(Main.java:151)Exception in thread "main" java.lang.IllegalArgumentException: Attribute 'sklearn.linear_model._logistic.LogisticRegression.multi_class' must be explicitly set to the 'ovr' or 'multinomial' valueat sklearn.linear_model.logistic.LogisticRegression.encodeModel(LogisticRegression.java:57)at sklearn2pmml.pipeline.PMMLPipeline.encodePMML(PMMLPipeline.java:231)at org.jpmml.sklearn.Main.run(Main.java:233)at org.jpmml.sklearn.Main.main(Main.java:151)Traceback (most recent call last):File "train.py", line 26, in <module>sklearn2pmml(model, './LogisticRegression.pmml', with_repr=True)File "/home/appleyuchi/anaconda3/envs/Python3.6/lib/python3.6/site-packages/sklearn2pmml/__init__.py", line 266, in sklearn2pmmlraise RuntimeError("The JPMML-SkLearn conversion application has failed. The Java executable should have printed more information about the failure into its standard output and/or standard error streams") RuntimeError: The JPMML-SkLearn conversion application has failed. The Java executable should have printed more information about the failure into its standard output and/or standard error streams?
解決方案:
model = PMMLPipeline([('LogisticModer', LogisticRegression())])
改成:
model = PMMLPipeline([('LogisticModer', LogisticRegression(multi_class='ovr'))])
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的Attribute ‘sklearn.linear_model._logistic.LogisticRegression.multi_class‘ must be explicitly set to的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: word怎么把文字改成竖向显示
- 下一篇: cannot resolve symbo