Skip to content

Commit 48fc38f

Browse files
committed
[SPARK-7619] [PYTHON] fix docstring signature
Just realized that we need `\` at the end of the docstring. brkyvz Author: Xiangrui Meng <[email protected]> Closes apache#6161 from mengxr/SPARK-7619 and squashes the following commits: e44495f [Xiangrui Meng] fix docstring signature
1 parent 723853e commit 48fc38f

File tree

5 files changed

+52
-55
lines changed

5 files changed

+52
-55
lines changed

python/docs/pyspark.ml.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
pyspark.ml package
2-
=====================
2+
==================
33

44
ML Pipeline APIs
5-
--------------
5+
----------------
66

77
.. automodule:: pyspark.ml
88
:members:
99
:undoc-members:
1010
:inherited-members:
1111

1212
pyspark.ml.param module
13-
-------------------------
13+
-----------------------
1414

1515
.. automodule:: pyspark.ml.param
1616
:members:
@@ -34,31 +34,31 @@ pyspark.ml.classification module
3434
:inherited-members:
3535

3636
pyspark.ml.recommendation module
37-
-------------------------
37+
--------------------------------
3838

3939
.. automodule:: pyspark.ml.recommendation
4040
:members:
4141
:undoc-members:
4242
:inherited-members:
4343

4444
pyspark.ml.regression module
45-
-------------------------
45+
----------------------------
4646

4747
.. automodule:: pyspark.ml.regression
4848
:members:
4949
:undoc-members:
5050
:inherited-members:
5151

5252
pyspark.ml.tuning module
53-
--------------------------------
53+
------------------------
5454

5555
.. automodule:: pyspark.ml.tuning
5656
:members:
5757
:undoc-members:
5858
:inherited-members:
5959

6060
pyspark.ml.evaluation module
61-
--------------------------------
61+
----------------------------
6262

6363
.. automodule:: pyspark.ml.evaluation
6464
:members:

python/pyspark/ml/classification.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
7171
threshold=0.5, probabilityCol="probability"):
7272
"""
7373
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
74-
maxIter=100, regParam=0.1, elasticNetParam=0.0, tol=1e-6, fitIntercept=True,
74+
maxIter=100, regParam=0.1, elasticNetParam=0.0, tol=1e-6, fitIntercept=True, \
7575
threshold=0.5, probabilityCol="probability")
7676
"""
7777
super(LogisticRegression, self).__init__()
@@ -96,8 +96,8 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
9696
maxIter=100, regParam=0.1, elasticNetParam=0.0, tol=1e-6, fitIntercept=True,
9797
threshold=0.5, probabilityCol="probability"):
9898
"""
99-
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
100-
maxIter=100, regParam=0.1, elasticNetParam=0.0, tol=1e-6, fitIntercept=True,
99+
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
100+
maxIter=100, regParam=0.1, elasticNetParam=0.0, tol=1e-6, fitIntercept=True, \
101101
threshold=0.5, probabilityCol="probability")
102102
Sets params for logistic regression.
103103
"""
@@ -220,7 +220,7 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
220220
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini"):
221221
"""
222222
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
223-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
223+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
224224
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini")
225225
"""
226226
super(DecisionTreeClassifier, self).__init__()
@@ -242,9 +242,8 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
242242
impurity="gini"):
243243
"""
244244
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
245-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
246-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
247-
impurity="gini")
245+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
246+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini")
248247
Sets params for the DecisionTreeClassifier.
249248
"""
250249
kwargs = self.setParams._input_kwargs
@@ -320,9 +319,9 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
320319
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini",
321320
numTrees=20, featureSubsetStrategy="auto", seed=42):
322321
"""
323-
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction",
324-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
325-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini",
322+
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
323+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
324+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini", \
326325
numTrees=20, featureSubsetStrategy="auto", seed=42)
327326
"""
328327
super(RandomForestClassifier, self).__init__()
@@ -355,9 +354,9 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
355354
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42,
356355
impurity="gini", numTrees=20, featureSubsetStrategy="auto"):
357356
"""
358-
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
359-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
360-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42,
357+
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
358+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
359+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42, \
361360
impurity="gini", numTrees=20, featureSubsetStrategy="auto")
362361
Sets params for linear classification.
363362
"""
@@ -471,10 +470,10 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
471470
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, lossType="logistic",
472471
maxIter=20, stepSize=0.1):
473472
"""
474-
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction",
475-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
476-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, lossType="logistic",
477-
maxIter=20, stepSize=0.1)
473+
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
474+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
475+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
476+
lossType="logistic", maxIter=20, stepSize=0.1)
478477
"""
479478
super(GBTClassifier, self).__init__()
480479
#: param for Loss function which GBT tries to minimize (case-insensitive).
@@ -502,9 +501,9 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
502501
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
503502
lossType="logistic", maxIter=20, stepSize=0.1):
504503
"""
505-
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
506-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
507-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
504+
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
505+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
506+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
508507
lossType="logistic", maxIter=20, stepSize=0.1)
509508
Sets params for Gradient Boosted Tree Classification.
510509
"""

python/pyspark/ml/feature.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ class RegexTokenizer(JavaTransformer, HasInputCol, HasOutputCol):
481481
def __init__(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+",
482482
inputCol=None, outputCol=None):
483483
"""
484-
__init__(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+",
484+
__init__(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+", \
485485
inputCol=None, outputCol=None)
486486
"""
487487
super(RegexTokenizer, self).__init__()
@@ -496,7 +496,7 @@ def __init__(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+"
496496
def setParams(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+",
497497
inputCol=None, outputCol=None):
498498
"""
499-
setParams(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+",
499+
setParams(self, minTokenLength=1, gaps=False, pattern="\\p{L}+|[^\\p{L}\\s]+", \
500500
inputCol="input", outputCol="output")
501501
Sets params for this RegexTokenizer.
502502
"""
@@ -869,7 +869,7 @@ class Word2Vec(JavaEstimator, HasStepSize, HasMaxIter, HasSeed, HasInputCol, Has
869869
def __init__(self, vectorSize=100, minCount=5, numPartitions=1, stepSize=0.025, maxIter=1,
870870
seed=42, inputCol=None, outputCol=None):
871871
"""
872-
__init__(self, vectorSize=100, minCount=5, numPartitions=1, stepSize=0.025, maxIter=1,
872+
__init__(self, vectorSize=100, minCount=5, numPartitions=1, stepSize=0.025, maxIter=1, \
873873
seed=42, inputCol=None, outputCol=None)
874874
"""
875875
super(Word2Vec, self).__init__()
@@ -889,7 +889,7 @@ def __init__(self, vectorSize=100, minCount=5, numPartitions=1, stepSize=0.025,
889889
def setParams(self, vectorSize=100, minCount=5, numPartitions=1, stepSize=0.025, maxIter=1,
890890
seed=42, inputCol=None, outputCol=None):
891891
"""
892-
setParams(self, minCount=5, numPartitions=1, stepSize=0.025, maxIter=1, seed=42,
892+
setParams(self, minCount=5, numPartitions=1, stepSize=0.025, maxIter=1, seed=42, \
893893
inputCol=None, outputCol=None)
894894
Sets params for this Word2Vec.
895895
"""

python/pyspark/ml/recommendation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ def __init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemB
9292
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
9393
ratingCol="rating", nonnegative=False, checkpointInterval=10):
9494
"""
95-
__init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
96-
implicitPrefs=false, alpha=1.0, userCol="user", itemCol="item", seed=0,
95+
__init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10, \
96+
implicitPrefs=false, alpha=1.0, userCol="user", itemCol="item", seed=0, \
9797
ratingCol="rating", nonnegative=false, checkpointInterval=10)
9898
"""
9999
super(ALS, self).__init__()
@@ -118,8 +118,8 @@ def setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItem
118118
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
119119
ratingCol="rating", nonnegative=False, checkpointInterval=10):
120120
"""
121-
setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
122-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
121+
setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10, \
122+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0, \
123123
ratingCol="rating", nonnegative=False, checkpointInterval=10)
124124
Sets params for ALS.
125125
"""

python/pyspark/ml/regression.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class LinearRegression(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPrediction
3333
Linear regression.
3434
3535
The learning objective is to minimize the squared error, with regularization.
36-
The specific squared error loss function used is:
37-
L = 1/2n ||A weights - y||^2^
36+
The specific squared error loss function used is: L = 1/2n ||A weights - y||^2^
3837
3938
This support multiple types of regularization:
4039
- none (a.k.a. ordinary least squares)
@@ -191,7 +190,7 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
191190
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="variance"):
192191
"""
193192
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
194-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
193+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
195194
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="variance")
196195
"""
197196
super(DecisionTreeRegressor, self).__init__()
@@ -213,9 +212,8 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
213212
impurity="variance"):
214213
"""
215214
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
216-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
217-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
218-
impurity="variance")
215+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
216+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="variance")
219217
Sets params for the DecisionTreeRegressor.
220218
"""
221219
kwargs = self.setParams._input_kwargs
@@ -286,10 +284,10 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
286284
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="variance",
287285
numTrees=20, featureSubsetStrategy="auto", seed=42):
288286
"""
289-
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction",
290-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
291-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="variance",
292-
numTrees=20, featureSubsetStrategy="auto", seed=42)
287+
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
288+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
289+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
290+
impurity="variance", numTrees=20, featureSubsetStrategy="auto", seed=42)
293291
"""
294292
super(RandomForestRegressor, self).__init__()
295293
#: param for Criterion used for information gain calculation (case-insensitive).
@@ -321,9 +319,9 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
321319
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42,
322320
impurity="variance", numTrees=20, featureSubsetStrategy="auto"):
323321
"""
324-
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
325-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
326-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42,
322+
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
323+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
324+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42, \
327325
impurity="variance", numTrees=20, featureSubsetStrategy="auto")
328326
Sets params for linear regression.
329327
"""
@@ -432,10 +430,10 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
432430
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, lossType="squared",
433431
maxIter=20, stepSize=0.1):
434432
"""
435-
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction",
436-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
437-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, lossType="squared",
438-
maxIter=20, stepSize=0.1)
433+
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
434+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
435+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
436+
lossType="squared", maxIter=20, stepSize=0.1)
439437
"""
440438
super(GBTRegressor, self).__init__()
441439
#: param for Loss function which GBT tries to minimize (case-insensitive).
@@ -463,9 +461,9 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
463461
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
464462
lossType="squared", maxIter=20, stepSize=0.1):
465463
"""
466-
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
467-
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
468-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10,
464+
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
465+
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
466+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, \
469467
lossType="squared", maxIter=20, stepSize=0.1)
470468
Sets params for Gradient Boosted Tree Regression.
471469
"""

0 commit comments

Comments
 (0)