Skip to content

Commit df8a89e

Browse files
committed
added pmml version to pmml model
changed the copyright to spark
1 parent a1b4dc3 commit df8a89e

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

mllib/src/main/scala/org/apache/spark/mllib/export/pmml/PMMLModelExport.scala

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,39 @@
1717

1818
package org.apache.spark.mllib.export.pmml
1919

20-
import org.apache.spark.mllib.export.ModelExport
21-
import java.io.OutputStream
22-
import org.jpmml.model.JAXBUtil
23-
import org.dmg.pmml.PMML
24-
import javax.xml.transform.stream.StreamResult
20+
import java.text.SimpleDateFormat
21+
import java.util.Date
22+
2523
import scala.beans.BeanProperty
24+
2625
import org.dmg.pmml.Application
27-
import org.dmg.pmml.Timestamp
2826
import org.dmg.pmml.Header
29-
import java.text.SimpleDateFormat
30-
import java.util.Date
27+
import org.dmg.pmml.PMML
28+
import org.dmg.pmml.Timestamp
29+
30+
import org.apache.spark.mllib.export.ModelExport
3131

32-
trait PMMLModelExport extends ModelExport{
32+
private[mllib] trait PMMLModelExport extends ModelExport{
3333

3434
/**
3535
* Holder of the exported model in PMML format
3636
*/
3737
@BeanProperty
38-
var pmml: PMML = new PMML();
38+
val pmml: PMML = new PMML();
3939

4040
setHeader(pmml);
4141

4242
private def setHeader(pmml : PMML): Unit = {
43-
var version = getClass().getPackage().getImplementationVersion()
44-
var app = new Application().withName("Apache Spark MLlib").withVersion(version)
45-
var timestamp = new Timestamp()
43+
val version = getClass().getPackage().getImplementationVersion()
44+
val app = new Application().withName("Apache Spark MLlib").withVersion(version)
45+
val timestamp = new Timestamp()
4646
.withContent(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date()))
47-
var header = new Header()
48-
.withCopyright("www.dmg.org")
47+
val header = new Header()
48+
.withCopyright("Apache Spark MLlib")
4949
.withApplication(app)
5050
.withTimestamp(timestamp);
5151
pmml.setHeader(header);
52+
pmml.setVersion("4.2")
5253
}
5354

54-
/**
55-
* Write the exported model (in PMML XML) to the output stream specified
56-
*/
57-
@Override
58-
def save(outputStream: OutputStream): Unit = {
59-
JAXBUtil.marshalPMML(pmml, new StreamResult(outputStream));
60-
}
61-
6255
}

0 commit comments

Comments
 (0)