aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/python/kmeans.py
diff options
context:
space:
mode:
authorBurak <brkyvz@gmail.com>2014-07-21 17:03:40 -0700
committerXiangrui Meng <meng@databricks.com>2014-07-21 17:03:40 -0700
commita4d60208ec7995146541451849c51670cdc56451 (patch)
tree97bb3b039136994ca210ade8f0436f1923a294b9 /examples/src/main/python/kmeans.py
parentabeacffb7bcdfa3eeb1e969aa546029a7b464eaa (diff)
downloadspark-a4d60208ec7995146541451849c51670cdc56451.tar.gz
spark-a4d60208ec7995146541451849c51670cdc56451.tar.bz2
spark-a4d60208ec7995146541451849c51670cdc56451.zip
[SPARK-2434][MLlib]: Warning messages that point users to original MLlib implementations added to Examples
[SPARK-2434][MLlib]: Warning messages that refer users to the original MLlib implementations of some popular example machine learning algorithms added both in the comments and the code. The following examples have been modified: Scala: * LocalALS * LocalFileLR * LocalKMeans * LocalLP * SparkALS * SparkHdfsLR * SparkKMeans * SparkLR Python: * kmeans.py * als.py * logistic_regression.py Author: Burak <brkyvz@gmail.com> Closes #1515 from brkyvz/SPARK-2434 and squashes the following commits: 7505da9 [Burak] [SPARK-2434][MLlib]: Warning messages added, scalastyle errors fixed, and added missing punctuation b96b522 [Burak] [SPARK-2434][MLlib]: Warning messages added and scalastyle errors fixed 4762f39 [Burak] [SPARK-2434]: Warning messages added 17d3d83 [Burak] SPARK-2434: Added warning messages to the naive implementations of the example algorithms 2cb5301 [Burak] SPARK-2434: Warning messages redirecting to original implementaions added.
Diffstat (limited to 'examples/src/main/python/kmeans.py')
-rwxr-xr-xexamples/src/main/python/kmeans.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/src/main/python/kmeans.py b/examples/src/main/python/kmeans.py
index 988fc45baf..036bdf4c4f 100755
--- a/examples/src/main/python/kmeans.py
+++ b/examples/src/main/python/kmeans.py
@@ -45,9 +45,15 @@ def closestPoint(p, centers):
if __name__ == "__main__":
+
if len(sys.argv) != 4:
print >> sys.stderr, "Usage: kmeans <file> <k> <convergeDist>"
exit(-1)
+
+ print >> sys.stderr, """WARN: This is a naive implementation of KMeans Clustering and is given
+ as an example! Please refer to examples/src/main/python/mllib/kmeans.py for an example on
+ how to use MLlib's KMeans implementation."""
+
sc = SparkContext(appName="PythonKMeans")
lines = sc.textFile(sys.argv[1])
data = lines.map(parseVector).cache()