diff options
author | Burak Yavuz <brkyvz@gmail.com> | 2015-05-08 17:24:32 -0700 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-05-08 17:24:32 -0700 |
commit | 84bf931f36edf1f319c9116f7f326959a6118991 (patch) | |
tree | ed7930e9cc5fe6855026689f5d0e4ebdfebb4832 /python/pyspark/ml/param | |
parent | 54e6fa0563ffa8788ec2fd1b8740445ef3c2ce5a (diff) | |
download | spark-84bf931f36edf1f319c9116f7f326959a6118991.tar.gz spark-84bf931f36edf1f319c9116f7f326959a6118991.tar.bz2 spark-84bf931f36edf1f319c9116f7f326959a6118991.zip |
[SPARK-7488] [ML] Feature Parity in PySpark for ml.recommendation
Adds Python Api for `ALS` under `ml.recommendation` in PySpark. Also adds seed as a settable parameter in the Scala Implementation of ALS.
Author: Burak Yavuz <brkyvz@gmail.com>
Closes #6015 from brkyvz/ml-rec and squashes the following commits:
be6e931 [Burak Yavuz] addressed comments
eaed879 [Burak Yavuz] readd numFeatures
0bd66b1 [Burak Yavuz] fixed seed
7f6d964 [Burak Yavuz] merged master
52e2bda [Burak Yavuz] added ALS
Diffstat (limited to 'python/pyspark/ml/param')
-rw-r--r-- | python/pyspark/ml/param/_shared_params_code_gen.py | 2 | ||||
-rw-r--r-- | python/pyspark/ml/param/shared.py | 29 |
2 files changed, 31 insertions, 0 deletions
diff --git a/python/pyspark/ml/param/_shared_params_code_gen.py b/python/pyspark/ml/param/_shared_params_code_gen.py index ee901f2584..ed3171b697 100644 --- a/python/pyspark/ml/param/_shared_params_code_gen.py +++ b/python/pyspark/ml/param/_shared_params_code_gen.py @@ -97,6 +97,8 @@ if __name__ == "__main__": ("inputCol", "input column name", None), ("inputCols", "input column names", None), ("outputCol", "output column name", None), + ("numFeatures", "number of features", None), + ("checkpointInterval", "checkpoint interval (>= 1)", None), ("seed", "random seed", None), ("tol", "the convergence tolerance for iterative algorithms", None), ("stepSize", "Step size to be used for each iteration of optimization.", None)] diff --git a/python/pyspark/ml/param/shared.py b/python/pyspark/ml/param/shared.py index 5e7529c1dc..d0bcadee22 100644 --- a/python/pyspark/ml/param/shared.py +++ b/python/pyspark/ml/param/shared.py @@ -310,6 +310,35 @@ class HasNumFeatures(Params): return self.getOrDefault(self.numFeatures) +class HasCheckpointInterval(Params): + """ + Mixin for param checkpointInterval: checkpoint interval (>= 1). + """ + + # a placeholder to make it appear in the generated doc + checkpointInterval = Param(Params._dummy(), "checkpointInterval", "checkpoint interval (>= 1)") + + def __init__(self): + super(HasCheckpointInterval, self).__init__() + #: param for checkpoint interval (>= 1) + self.checkpointInterval = Param(self, "checkpointInterval", "checkpoint interval (>= 1)") + if None is not None: + self._setDefault(checkpointInterval=None) + + def setCheckpointInterval(self, value): + """ + Sets the value of :py:attr:`checkpointInterval`. + """ + self.paramMap[self.checkpointInterval] = value + return self + + def getCheckpointInterval(self): + """ + Gets the value of checkpointInterval or its default value. + """ + return self.getOrDefault(self.checkpointInterval) + + class HasSeed(Params): """ Mixin for param seed: random seed. |