File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
mllib/src/main/scala/org/apache/spark/mllib/pmml Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ import java.io.OutputStream
2222import java .io .StringWriter
2323import javax .xml .transform .stream .StreamResult
2424import org .jpmml .model .JAXBUtil
25+ import org .apache .spark .SparkContext
2526import org .apache .spark .mllib .pmml .export .PMMLModelExport
2627import org .apache .spark .mllib .pmml .export .PMMLModelExportFactory
2728
2829/**
2930 * Export model to the PMML format
30- * Predictive Model Markup Language (PMML) in an XML-based file format
31+ * Predictive Model Markup Language (PMML) is an XML-based file format
3132 * developed by the Data Mining Group (www.dmg.org).
3233 */
3334trait PMMLExportable {
@@ -47,6 +48,14 @@ trait PMMLExportable {
4748 toPMML(new StreamResult (new File (localPath)))
4849 }
4950
51+ /**
52+ * Export the model to a distributed file in PMML format
53+ */
54+ def toPMML (sc : SparkContext , path : String ): Unit = {
55+ val pmml = toPMML()
56+ sc.parallelize(Array (pmml),1 ).saveAsTextFile(path)
57+ }
58+
5059 /**
5160 * Export the model to the Outputtream in PMML format
5261 */
You can’t perform that action at this time.
0 commit comments