Skip to content

Commit c5aca0c

Browse files
gweidnerjkbradley
authored andcommitted
[SPARK-7427] [PYSPARK] Make sharedParams match in Scala, Python
Modified 2 files: python/pyspark/ml/param/_shared_params_code_gen.py python/pyspark/ml/param/shared.py Generated shared.py on Linux using Python 2.6.6 on Redhat Enterprise Linux Server 6.6. python _shared_params_code_gen.py > shared.py Only changed maxIter, regParam, rawPredictionCol based on strings from SharedParamsCodeGen.scala. Note warning was displayed when committing shared.py: warning: LF will be replaced by CRLF in python/pyspark/ml/param/shared.py. Author: Glenn Weidner <[email protected]> Closes #6023 from gweidner/br-7427 and squashes the following commits: db72e32 [Glenn Weidner] [SPARK-7427] [PySpark] Make sharedParams match in Scala, Python 825e4a9 [Glenn Weidner] [SPARK-7427] [PySpark] Make sharedParams match in Scala, Python e6a865e [Glenn Weidner] [SPARK-7427] [PySpark] Make sharedParams match in Scala, Python 1eee702 [Glenn Weidner] Merge remote-tracking branch 'upstream/master' 1ac10e5 [Glenn Weidner] Merge remote-tracking branch 'upstream/master' cafd104 [Glenn Weidner] Merge remote-tracking branch 'upstream/master' 9bea1eb [Glenn Weidner] Merge remote-tracking branch 'upstream/master' 4a35c20 [Glenn Weidner] Merge remote-tracking branch 'upstream/master' 9790cbe [Glenn Weidner] Merge remote-tracking branch 'upstream/master' d9c30f4 [Glenn Weidner] [SPARK-7275] [SQL] [WIP] Make LogicalRelation public
1 parent 8c07c75 commit c5aca0c

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

python/pyspark/ml/param/_shared_params_code_gen.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ def get$Name(self):
8888
print("\n# DO NOT MODIFY THIS FILE! It was generated by _shared_params_code_gen.py.\n")
8989
print("from pyspark.ml.param import Param, Params\n\n")
9090
shared = [
91-
("maxIter", "max number of iterations", None),
92-
("regParam", "regularization constant", None),
91+
("maxIter", "max number of iterations (>= 0)", None),
92+
("regParam", "regularization parameter (>= 0)", None),
9393
("featuresCol", "features column name", "'features'"),
9494
("labelCol", "label column name", "'label'"),
9595
("predictionCol", "prediction column name", "'prediction'"),
96-
("rawPredictionCol", "raw prediction column name", "'rawPrediction'"),
96+
("rawPredictionCol", "raw prediction (a.k.a. confidence) column name", "'rawPrediction'"),
9797
("inputCol", "input column name", None),
9898
("inputCols", "input column names", None),
9999
("outputCol", "output column name", None),

python/pyspark/ml/param/shared.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@
2222

2323
class HasMaxIter(Params):
2424
"""
25-
Mixin for param maxIter: max number of iterations.
25+
Mixin for param maxIter: max number of iterations (>= 0).
2626
"""
2727

2828
# a placeholder to make it appear in the generated doc
29-
maxIter = Param(Params._dummy(), "maxIter", "max number of iterations")
29+
maxIter = Param(Params._dummy(), "maxIter", "max number of iterations (>= 0)")
3030

3131
def __init__(self):
3232
super(HasMaxIter, self).__init__()
33-
#: param for max number of iterations
34-
self.maxIter = Param(self, "maxIter", "max number of iterations")
33+
#: param for max number of iterations (>= 0)
34+
self.maxIter = Param(self, "maxIter", "max number of iterations (>= 0)")
3535
if None is not None:
3636
self._setDefault(maxIter=None)
3737

@@ -51,16 +51,16 @@ def getMaxIter(self):
5151

5252
class HasRegParam(Params):
5353
"""
54-
Mixin for param regParam: regularization constant.
54+
Mixin for param regParam: regularization parameter (>= 0).
5555
"""
5656

5757
# a placeholder to make it appear in the generated doc
58-
regParam = Param(Params._dummy(), "regParam", "regularization constant")
58+
regParam = Param(Params._dummy(), "regParam", "regularization parameter (>= 0)")
5959

6060
def __init__(self):
6161
super(HasRegParam, self).__init__()
62-
#: param for regularization constant
63-
self.regParam = Param(self, "regParam", "regularization constant")
62+
#: param for regularization parameter (>= 0)
63+
self.regParam = Param(self, "regParam", "regularization parameter (>= 0)")
6464
if None is not None:
6565
self._setDefault(regParam=None)
6666

@@ -167,16 +167,16 @@ def getPredictionCol(self):
167167

168168
class HasRawPredictionCol(Params):
169169
"""
170-
Mixin for param rawPredictionCol: raw prediction column name.
170+
Mixin for param rawPredictionCol: raw prediction (a.k.a. confidence) column name.
171171
"""
172172

173173
# a placeholder to make it appear in the generated doc
174-
rawPredictionCol = Param(Params._dummy(), "rawPredictionCol", "raw prediction column name")
174+
rawPredictionCol = Param(Params._dummy(), "rawPredictionCol", "raw prediction (a.k.a. confidence) column name")
175175

176176
def __init__(self):
177177
super(HasRawPredictionCol, self).__init__()
178-
#: param for raw prediction column name
179-
self.rawPredictionCol = Param(self, "rawPredictionCol", "raw prediction column name")
178+
#: param for raw prediction (a.k.a. confidence) column name
179+
self.rawPredictionCol = Param(self, "rawPredictionCol", "raw prediction (a.k.a. confidence) column name")
180180
if 'rawPrediction' is not None:
181181
self._setDefault(rawPredictionCol='rawPrediction')
182182

@@ -403,14 +403,12 @@ class HasStepSize(Params):
403403
"""
404404

405405
# a placeholder to make it appear in the generated doc
406-
stepSize = Param(Params._dummy(), "stepSize",
407-
"Step size to be used for each iteration of optimization.")
406+
stepSize = Param(Params._dummy(), "stepSize", "Step size to be used for each iteration of optimization.")
408407

409408
def __init__(self):
410409
super(HasStepSize, self).__init__()
411410
#: param for Step size to be used for each iteration of optimization.
412-
self.stepSize = Param(self, "stepSize",
413-
"Step size to be used for each iteration of optimization.")
411+
self.stepSize = Param(self, "stepSize", "Step size to be used for each iteration of optimization.")
414412
if None is not None:
415413
self._setDefault(stepSize=None)
416414

python/pyspark/ml/tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_param(self):
128128
testParams = TestParams()
129129
maxIter = testParams.maxIter
130130
self.assertEqual(maxIter.name, "maxIter")
131-
self.assertEqual(maxIter.doc, "max number of iterations")
131+
self.assertEqual(maxIter.doc, "max number of iterations (>= 0)")
132132
self.assertTrue(maxIter.parent is testParams)
133133

134134
def test_params(self):
@@ -156,7 +156,7 @@ def test_params(self):
156156
self.assertEquals(
157157
testParams.explainParams(),
158158
"\n".join(["inputCol: input column name (undefined)",
159-
"maxIter: max number of iterations (default: 10, current: 100)"]))
159+
"maxIter: max number of iterations (>= 0) (default: 10, current: 100)"]))
160160

161161

162162
if __name__ == "__main__":

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515

1616
[pep8]
1717
max-line-length=100
18-
exclude=cloudpickle.py,heapq3.py
18+
exclude=cloudpickle.py,heapq3.py,shared.py

0 commit comments

Comments
 (0)