stephanie / LoadPmmlKmeans / 1.0.0


Demo of hosting and deploying a KMeans PMML model trained on dummy data in Spark MLlib that takes an integer as input and returns the Euclidean distance from that input to the cluster's centroid from the trained model.

There are two clusters in this model, one with a centroid of 9.1 and one with a centroid of 0.1 so when you pass in input, the closer your input to either of those numbers, the smaller the distance will be.

Applicable Scenarios and Problems

Demonstrating deploying a PMML model trained in Spark



Any numeric value integer or float


result = cluster id (1 or 2) distance_entries = float that represents the distance from that cluster's centroid.


Input: 9.2

Output: "{result=2, distance_entries=[1=248.42999999999995, 2=0.029999999999999787], entityId=2}"