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

scala 模型导出问题

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

    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   ·   实用小工具   ·   2927 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 08:03 · PVG 16:03 · LAX 00:03 · JFK 03:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.