Skip to content

Commit

Permalink
removed version, by default is set to 4.2 (latest from jpmml)
Browse files Browse the repository at this point in the history
removed copyright
  • Loading branch information
selvinsource committed Nov 5, 2014
1 parent ae8b993 commit e29dfb9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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){

Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

}

0 comments on commit e29dfb9

Please sign in to comment.