V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
asensio
V2EX  ›  Scala

scala 模型导出问题

  •  
  •   asensio · 2021-01-26 10:35:26 +08:00 · 1336 次点击
    这是一个创建于 1379 天前的主题,其中的信息可能已经有所发展或是发生改变。

    spark ml 导出模型 pmml 文件不成功,下面是 scala 代码

            val pmml = new PMMLBuilder(trainingData.schema, model).build()
            val targetFile = "target/model.pmml"
            val fis: FileOutputStream = new FileOutputStream(targetFile)
            val fout: StreamResult = new StreamResult(fis)
            JAXBUtil.marshalPMML(pmml, fout)
    
    Exception in thread "main" java.lang.IllegalArgumentException: Expected string, integral, double or boolean data type, got vector data type
    	at org.jpmml.sparkml.SparkMLEncoder.createDataField(SparkMLEncoder.java:169)
    	at org.jpmml.sparkml.SparkMLEncoder.getFeatures(SparkMLEncoder.java:76)
    	at org.jpmml.sparkml.feature.VectorIndexerModelConverter.encodeFeatures(VectorIndexerModelConverter.java:52)
    	at org.jpmml.sparkml.FeatureConverter.registerFeatures(FeatureConverter.java:50)
    	at org.jpmml.sparkml.PMMLBuilder.build(PMMLBuilder.java:114)
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   4916 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:39 · PVG 13:39 · LAX 21:39 · JFK 00:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.