From e29dfb99ffecb3cd78e5f2a1357b2244bc9c9737 Mon Sep 17 00:00:00 2001 From: Vincenzo Selvaggio Date: Wed, 5 Nov 2014 12:38:07 +0000 Subject: [PATCH] removed version, by default is set to 4.2 (latest from jpmml) removed copyright --- .../mllib/export/pmml/KMeansPMMLModelExport.scala | 14 +++++++------- .../spark/mllib/export/pmml/PMMLModelExport.scala | 6 ++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/KMeansPMMLModelExport.scala b/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/KMeansPMMLModelExport.scala index e166ae67f7edd..909f172fc1f72 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/KMeansPMMLModelExport.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/KMeansPMMLModelExport.scala @@ -46,11 +46,11 @@ private[mllib] class KMeansPMMLModelExport(model : KMeansModel) extends PMMLMode /** * Export the input KMeansModel model to PMML format */ - populateKMeansPMML(model); + populateKMeansPMML(model) private def populateKMeansPMML(model : KMeansModel): Unit = { - pmml.getHeader().setDescription("k-means clustering"); + pmml.getHeader().setDescription("k-means clustering") if(model.clusterCenters.length > 0){ @@ -65,11 +65,11 @@ private[mllib] class KMeansPMMLModelExport(model : KMeansModel) extends PMMLMode val comparisonMeasure = new ComparisonMeasure() .withKind(Kind.DISTANCE) .withMeasure(new SquaredEuclidean() - ); + ) val clusteringModel = new ClusteringModel(miningSchema, comparisonMeasure, MiningFunctionType.CLUSTERING, ModelClass.CENTER_BASED, model.clusterCenters.length) - .withModelName("k-means"); + .withModelName("k-means") for ( i <- 0 to (clusterCenter.size - 1)) { fields(i) = FieldName.create("field_" + i) @@ -83,7 +83,7 @@ private[mllib] class KMeansPMMLModelExport(model : KMeansModel) extends PMMLMode ) } - dataDictionary.withNumberOfFields((dataDictionary.getDataFields()).size()); + dataDictionary.withNumberOfFields((dataDictionary.getDataFields()).size()) for ( i <- 0 until model.clusterCenters.size ) { val cluster = new Cluster() @@ -97,8 +97,8 @@ private[mllib] class KMeansPMMLModelExport(model : KMeansModel) extends PMMLMode clusteringModel.withClusters(cluster) } - pmml.setDataDictionary(dataDictionary); - pmml.withModels(clusteringModel); + pmml.setDataDictionary(dataDictionary) + pmml.withModels(clusteringModel) } diff --git a/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/PMMLModelExport.scala b/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/PMMLModelExport.scala index 665eff71644ad..cf9f993e88e59 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/PMMLModelExport.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/export/pmml/PMMLModelExport.scala @@ -45,11 +45,9 @@ private[mllib] trait PMMLModelExport extends ModelExport{ val timestamp = new Timestamp() .withContent(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date())) val header = new Header() - .withCopyright("Apache Spark MLlib") .withApplication(app) - .withTimestamp(timestamp); - pmml.setHeader(header); - pmml.setVersion("4.2") + .withTimestamp(timestamp) + pmml.setHeader(header) } }