aboutsummaryrefslogtreecommitdiff
path: root/examples/src/main/python/als.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/src/main/python/als.py')
-rwxr-xr-xexamples/src/main/python/als.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/src/main/python/als.py b/examples/src/main/python/als.py
index 1a7c4c51f4..c862650b0a 100755
--- a/examples/src/main/python/als.py
+++ b/examples/src/main/python/als.py
@@ -16,6 +16,9 @@
#
"""
+This is an example implementation of ALS for learning how to use Spark. Please refer to
+ALS in pyspark.mllib.recommendation for more conventional use.
+
This example requires numpy (http://www.numpy.org/)
"""
from os.path import realpath
@@ -49,9 +52,15 @@ def update(i, vec, mat, ratings):
if __name__ == "__main__":
+
"""
Usage: als [M] [U] [F] [iterations] [slices]"
"""
+
+ print >> sys.stderr, """WARN: This is a naive implementation of ALS and is given as an
+ example. Please use the ALS method found in pyspark.mllib.recommendation for more
+ conventional use."""
+
sc = SparkContext(appName="PythonALS")
M = int(sys.argv[1]) if len(sys.argv) > 1 else 100
U = int(sys.argv[2]) if len(sys.argv) > 2 else 500