Skip to content

Commit

Permalink
[DOC] [PYSPARK] [MLLIB] Added newlines to docstrings to fix parameter…
Browse files Browse the repository at this point in the history
… formatting

Added newlines before `:param ...:` and `:return:` markup. Without these, parameter lists aren't formatted correctly in the API docs. I.e:

![screen shot 2015-09-21 at 21 49 26](https://cloud.githubusercontent.com/assets/11915197/10004686/de3c41d4-60aa-11e5-9c50-a46dcb51243f.png)

.. looks like this once newline is added:

![screen shot 2015-09-21 at 21 50 14](https://cloud.githubusercontent.com/assets/11915197/10004706/f86bfb08-60aa-11e5-8524-ae4436713502.png)

Author: noelsmith <[email protected]>

Closes apache#8851 from noel-smith/docstring-missing-newline-fix.
  • Loading branch information
noel-smith authored and mengxr committed Sep 21, 2015
1 parent 362539f commit 7c4f852
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions python/pyspark/ml/param/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def extractParamMap(self, extra=None):
a flat param map, where the latter value is used if there exist
conflicts, i.e., with ordering: default param values <
user-supplied values < extra.
:param extra: extra param values
:return: merged param map
"""
Expand All @@ -182,6 +183,7 @@ def copy(self, extra=None):
embedded and extra parameters over and returns the copy.
Subclasses should override this method if the default approach
is not sufficient.
:param extra: Extra parameters to copy to the new instance
:return: Copy of this instance
"""
Expand All @@ -201,6 +203,7 @@ def _shouldOwn(self, param):
def _resolveParam(self, param):
"""
Resolves a param and validates the ownership.
:param param: param name or the param instance, which must
belong to this Params instance
:return: resolved param instance
Expand Down Expand Up @@ -243,6 +246,7 @@ def _copyValues(self, to, extra=None):
"""
Copies param values from this instance to another instance for
params shared by them.
:param to: the target instance
:param extra: extra params to be copied
:return: the target instance with param values copied
Expand Down
1 change: 1 addition & 0 deletions python/pyspark/ml/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def __init__(self, stages=None):
def setStages(self, value):
"""
Set pipeline stages.
:param value: a list of transformers or estimators
:return: the pipeline instance
"""
Expand Down
2 changes: 2 additions & 0 deletions python/pyspark/ml/tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def copy(self, extra=None):
Creates a copy of this instance with a randomly generated uid
and some extra params. This copies creates a deep copy of
the embedded paramMap, and copies the embedded and extra parameters over.
:param extra: Extra parameters to copy to the new instance
:return: Copy of this instance
"""
Expand Down Expand Up @@ -290,6 +291,7 @@ def copy(self, extra=None):
and some extra params. This copies the underlying bestModel,
creates a deep copy of the embedded paramMap, and
copies the embedded and extra parameters over.
:param extra: Extra parameters to copy to the new instance
:return: Copy of this instance
"""
Expand Down
2 changes: 2 additions & 0 deletions python/pyspark/ml/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def _create_model(self, java_model):
def _fit_java(self, dataset):
"""
Fits a Java model to the input dataset.
:param dataset: input dataset, which is an instance of
:py:class:`pyspark.sql.DataFrame`
:param params: additional params (overwriting embedded values)
Expand Down Expand Up @@ -173,6 +174,7 @@ def copy(self, extra=None):
extra params. This implementation first calls Params.copy and
then make a copy of the companion Java model with extra params.
So both the Python wrapper and the Java model get copied.
:param extra: Extra parameters to copy to the new instance
:return: Copy of this instance
"""
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/mllib/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class MulticlassMetrics(JavaModelWrapper):
"""
Evaluator for multiclass classification.
:param predictionAndLabels an RDD of (prediction, label) pairs.
:param predictionAndLabels: an RDD of (prediction, label) pairs.
>>> predictionAndLabels = sc.parallelize([(0.0, 0.0), (0.0, 1.0), (0.0, 0.0),
... (1.0, 0.0), (1.0, 1.0), (1.0, 1.0), (1.0, 1.0), (2.0, 2.0), (2.0, 0.0)])
Expand Down
1 change: 1 addition & 0 deletions python/pyspark/mllib/linalg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ class Vector(object):
def toArray(self):
"""
Convert the vector into an numpy.ndarray
:return: numpy.ndarray
"""
raise NotImplementedError
Expand Down
2 changes: 2 additions & 0 deletions python/pyspark/streaming/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def start(self):
def awaitTermination(self, timeout=None):
"""
Wait for the execution to stop.
@param timeout: time to wait in seconds
"""
if timeout is None:
Expand All @@ -252,6 +253,7 @@ def awaitTerminationOrTimeout(self, timeout):
Wait for the execution to stop. Return `true` if it's stopped; or
throw the reported error during the execution; or `false` if the
waiting time elapsed before returning from the method.
@param timeout: time to wait in seconds
"""
self._jssc.awaitTerminationOrTimeout(int(timeout * 1000))
Expand Down
1 change: 1 addition & 0 deletions python/pyspark/streaming/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def createStream(ssc, brokerUrl, topic,
storageLevel=StorageLevel.MEMORY_AND_DISK_SER_2):
"""
Create an input stream that pulls messages from a Mqtt Broker.
:param ssc: StreamingContext object
:param brokerUrl: Url of remote mqtt publisher
:param topic: topic name to subscribe to
Expand Down

0 comments on commit 7c4f852

Please sign in to comment.