aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/python/logistic_regression.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/logistic_regression.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/logistic_regression.py')
-rwxr-xr-xexamples/src/main/python/logistic_regression.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/src/main/python/logistic_regression.py b/examples/src/main/python/logistic_regression.py
index 6c33deabfd..8456b272f9 100755
--- a/examples/src/main/python/logistic_regression.py
+++ b/examples/src/main/python/logistic_regression.py
@@ -47,9 +47,15 @@ def readPointBatch(iterator):
return [matrix]
if __name__ == "__main__":
+
if len(sys.argv) != 3:
print >> sys.stderr, "Usage: logistic_regression <file> <iterations>"
exit(-1)
+
+ print >> sys.stderr, """WARN: This is a naive implementation of Logistic Regression and is
+ given as an example! Please refer to examples/src/main/python/mllib/logistic_regression.py
+ to see how MLlib's implementation is used."""
+
sc = SparkContext(appName="PythonLR")
points = sc.textFile(sys.argv[1]).mapPartitions(readPointBatch).cache()
iterations = int(sys.argv[2])