aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHrishikesh Subramonian <hrishikesh.subramonian@flytxt.com>2015-05-05 07:57:39 -0700
committerXiangrui Meng <meng@databricks.com>2015-05-05 07:57:39 -0700
commit5995ada96b661546a80657f2c5ed20604593e4aa (patch)
tree5ea7879e611aa34fd912d93e253ad69d0799a665 /examples
parent5ab652cdb8bef10214edd079502a7f49017579aa (diff)
downloadspark-5995ada96b661546a80657f2c5ed20604593e4aa.tar.gz
spark-5995ada96b661546a80657f2c5ed20604593e4aa.tar.bz2
spark-5995ada96b661546a80657f2c5ed20604593e4aa.zip
[SPARK-6612] [MLLIB] [PYSPARK] Python KMeans parity
The following items are added to Python kmeans: kmeans - setEpsilon, setInitializationSteps KMeansModel - computeCost, k Author: Hrishikesh Subramonian <hrishikesh.subramonian@flytxt.com> Closes #5647 from FlytxtRnD/newPyKmeansAPI and squashes the following commits: b9e451b [Hrishikesh Subramonian] set seed to fixed value in doc test 5fd3ced [Hrishikesh Subramonian] doc test corrections 20b3c68 [Hrishikesh Subramonian] python 3 fixes 4d4e695 [Hrishikesh Subramonian] added arguments in python tests 21eb84c [Hrishikesh Subramonian] Python Kmeans - setEpsilon, setInitializationSteps, k and computeCost added.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/src/main/python/mllib/kmeans.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/src/main/python/mllib/kmeans.py b/examples/src/main/python/mllib/kmeans.py
index f901a87fa6..002fc75799 100755
--- a/examples/src/main/python/mllib/kmeans.py
+++ b/examples/src/main/python/mllib/kmeans.py
@@ -43,4 +43,5 @@ if __name__ == "__main__":
k = int(sys.argv[2])
model = KMeans.train(data, k)
print("Final centers: " + str(model.clusterCenters))
+ print("Total Cost: " + str(model.computeCost(data)))
sc.stop()