aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml/pipeline.py
diff options
context:
space:
mode:
authorlihao <lihaowhu@gmail.com>2015-11-02 16:09:22 -0800
committerXiangrui Meng <meng@databricks.com>2015-11-02 16:09:22 -0800
commitecfb3e73fd0a99f0be96034710974e78b6f9d624 (patch)
tree7a7b2d6d2052aa0ef524ad65ccaab77b4b6289b4 /python/pyspark/ml/pipeline.py
parent2804674a7af8f11eeb1280459bc9145815398eed (diff)
downloadspark-ecfb3e73fd0a99f0be96034710974e78b6f9d624.tar.gz
spark-ecfb3e73fd0a99f0be96034710974e78b6f9d624.tar.bz2
spark-ecfb3e73fd0a99f0be96034710974e78b6f9d624.zip
[SPARK-10286][ML][PYSPARK][DOCS] Add @since annotation to pyspark.ml.param and pyspark.ml.*
Author: lihao <lihaowhu@gmail.com> Closes #9275 from lidinghao/SPARK-10286.
Diffstat (limited to 'python/pyspark/ml/pipeline.py')
-rw-r--r--python/pyspark/ml/pipeline.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/python/pyspark/ml/pipeline.py b/python/pyspark/ml/pipeline.py
index 312a8502b3..4475451edb 100644
--- a/python/pyspark/ml/pipeline.py
+++ b/python/pyspark/ml/pipeline.py
@@ -17,6 +17,7 @@
from abc import ABCMeta, abstractmethod
+from pyspark import since
from pyspark.ml.param import Param, Params
from pyspark.ml.util import keyword_only
from pyspark.mllib.common import inherit_doc
@@ -26,6 +27,8 @@ from pyspark.mllib.common import inherit_doc
class Estimator(Params):
"""
Abstract class for estimators that fit models to data.
+
+ .. versionadded:: 1.3.0
"""
__metaclass__ = ABCMeta
@@ -42,6 +45,7 @@ class Estimator(Params):
"""
raise NotImplementedError()
+ @since("1.3.0")
def fit(self, dataset, params=None):
"""
Fits a model to the input dataset with optional parameters.
@@ -73,6 +77,8 @@ class Transformer(Params):
"""
Abstract class for transformers that transform one dataset into
another.
+
+ .. versionadded:: 1.3.0
"""
__metaclass__ = ABCMeta
@@ -88,6 +94,7 @@ class Transformer(Params):
"""
raise NotImplementedError()
+ @since("1.3.0")
def transform(self, dataset, params=None):
"""
Transforms the input dataset with optional parameters.
@@ -113,6 +120,8 @@ class Transformer(Params):
class Model(Transformer):
"""
Abstract class for models that are fitted by estimators.
+
+ .. versionadded:: 1.4.0
"""
__metaclass__ = ABCMeta
@@ -136,6 +145,8 @@ class Pipeline(Estimator):
consists of fitted models and transformers, corresponding to the
pipeline stages. If there are no stages, the pipeline acts as an
identity transformer.
+
+ .. versionadded:: 1.3.0
"""
@keyword_only
@@ -151,6 +162,7 @@ class Pipeline(Estimator):
kwargs = self.__init__._input_kwargs
self.setParams(**kwargs)
+ @since("1.3.0")
def setStages(self, value):
"""
Set pipeline stages.
@@ -161,6 +173,7 @@ class Pipeline(Estimator):
self._paramMap[self.stages] = value
return self
+ @since("1.3.0")
def getStages(self):
"""
Get pipeline stages.
@@ -169,6 +182,7 @@ class Pipeline(Estimator):
return self._paramMap[self.stages]
@keyword_only
+ @since("1.3.0")
def setParams(self, stages=None):
"""
setParams(self, stages=None)
@@ -204,7 +218,14 @@ class Pipeline(Estimator):
transformers.append(stage)
return PipelineModel(transformers)
+ @since("1.4.0")
def copy(self, extra=None):
+ """
+ Creates a copy of this instance.
+
+ :param extra: extra parameters
+ :returns: new instance
+ """
if extra is None:
extra = dict()
that = Params.copy(self, extra)
@@ -216,6 +237,8 @@ class Pipeline(Estimator):
class PipelineModel(Model):
"""
Represents a compiled pipeline with transformers and fitted models.
+
+ .. versionadded:: 1.3.0
"""
def __init__(self, stages):
@@ -227,7 +250,14 @@ class PipelineModel(Model):
dataset = t.transform(dataset)
return dataset
+ @since("1.4.0")
def copy(self, extra=None):
+ """
+ Creates a copy of this instance.
+
+ :param extra: extra parameters
+ :returns: new instance
+ """
if extra is None:
extra = dict()
stages = [stage.copy(extra) for stage in self.stages]