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
22
22
import java .io .StringWriter
23
23
import javax .xml .transform .stream .StreamResult
24
24
import org .jpmml .model .JAXBUtil
25
+ import org .apache .spark .SparkContext
25
26
import org .apache .spark .mllib .pmml .export .PMMLModelExport
26
27
import org .apache .spark .mllib .pmml .export .PMMLModelExportFactory
27
28
28
29
/**
29
30
* 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
31
32
* developed by the Data Mining Group (www.dmg.org).
32
33
*/
33
34
trait PMMLExportable {
@@ -47,6 +48,14 @@ trait PMMLExportable {
47
48
toPMML(new StreamResult (new File (localPath)))
48
49
}
49
50
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
+
50
59
/**
51
60
* Export the model to the Outputtream in PMML format
52
61
*/
You can’t perform that action at this time.
0 commit comments