本文整理汇总了Scala中org.dmg.pmml.Application类的典型用法代码示例。如果您正苦于以下问题:Scala Application类的具体用法?Scala Application怎么用?Scala Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ExportModel
//设置package包名称以及导入依赖的类
package com.cloudera.datascience.cdsw.acme
import java.nio.charset.StandardCharsets
import java.nio.file.StandardOpenOption._
import java.nio.file.{Files, Paths}
import javax.xml.transform.stream.StreamResult
import org.dmg.pmml.Application
import org.jpmml.model.JAXBUtil
import org.jpmml.sparkml.ConverterUtil
import acme.ACMEModel
object ExportModel {
def main(args: Array[String]): Unit = {
val training = ACMEData.readData()
val pipeline = ACMEModel.buildModel()
val pmml = ConverterUtil.toPMML(training.schema, pipeline)
pmml.getHeader.setApplication(new Application("ACME Occupancy Detection"))
val modelPath = Paths.get("src", "main", "resources")
if (!Files.exists(modelPath)) {
Files.createDirectory(modelPath)
}
val pmmlFile = modelPath.resolve("model.pmml")
val writer = Files.newBufferedWriter(pmmlFile, StandardCharsets.UTF_8, WRITE, CREATE, TRUNCATE_EXISTING)
try {
JAXBUtil.marshalPMML(pmml, new StreamResult(writer))
} finally {
writer.close()
}
}
}