You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by me...@apache.org on 2015/09/17 17:44:04 UTC
spark git commit: [SPARK-10284] [ML] [PYSPARK] [DOCS] Add @since
annotation to pyspark.ml.tuning
Repository: spark
Updated Branches:
refs/heads/master 69c9830d2 -> c633ed326
[SPARK-10284] [ML] [PYSPARK] [DOCS] Add @since annotation to pyspark.ml.tuning
Author: Yu ISHIKAWA <yu...@gmail.com>
Closes #8694 from yu-iskw/SPARK-10284.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c633ed32
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c633ed32
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c633ed32
Branch: refs/heads/master
Commit: c633ed3260140f1288f326acc4d7a10dcd2e27d5
Parents: 69c9830
Author: Yu ISHIKAWA <yu...@gmail.com>
Authored: Thu Sep 17 08:43:59 2015 -0700
Committer: Xiangrui Meng <me...@databricks.com>
Committed: Thu Sep 17 08:43:59 2015 -0700
----------------------------------------------------------------------
python/pyspark/ml/tuning.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/c633ed32/python/pyspark/ml/tuning.py
----------------------------------------------------------------------
diff --git a/python/pyspark/ml/tuning.py b/python/pyspark/ml/tuning.py
index cae7788..ab5621f 100644
--- a/python/pyspark/ml/tuning.py
+++ b/python/pyspark/ml/tuning.py
@@ -18,6 +18,7 @@
import itertools
import numpy as np
+from pyspark import since
from pyspark.ml.param import Params, Param
from pyspark.ml import Estimator, Model
from pyspark.ml.util import keyword_only
@@ -47,11 +48,14 @@ class ParamGridBuilder(object):
True
>>> all([m in expected for m in output])
True
+
+ .. versionadded:: 1.4.0
"""
def __init__(self):
self._param_grid = {}
+ @since("1.4.0")
def addGrid(self, param, values):
"""
Sets the given parameters in this grid to fixed values.
@@ -60,6 +64,7 @@ class ParamGridBuilder(object):
return self
+ @since("1.4.0")
def baseOn(self, *args):
"""
Sets the given parameters in this grid to fixed values.
@@ -73,6 +78,7 @@ class ParamGridBuilder(object):
return self
+ @since("1.4.0")
def build(self):
"""
Builds and returns all combinations of parameters specified
@@ -104,6 +110,8 @@ class CrossValidator(Estimator):
>>> cvModel = cv.fit(dataset)
>>> evaluator.evaluate(cvModel.transform(dataset))
0.8333...
+
+ .. versionadded:: 1.4.0
"""
# a placeholder to make it appear in the generated doc
@@ -142,6 +150,7 @@ class CrossValidator(Estimator):
self._set(**kwargs)
@keyword_only
+ @since("1.4.0")
def setParams(self, estimator=None, estimatorParamMaps=None, evaluator=None, numFolds=3):
"""
setParams(self, estimator=None, estimatorParamMaps=None, evaluator=None, numFolds=3):
@@ -150,6 +159,7 @@ class CrossValidator(Estimator):
kwargs = self.setParams._input_kwargs
return self._set(**kwargs)
+ @since("1.4.0")
def setEstimator(self, value):
"""
Sets the value of :py:attr:`estimator`.
@@ -157,12 +167,14 @@ class CrossValidator(Estimator):
self._paramMap[self.estimator] = value
return self
+ @since("1.4.0")
def getEstimator(self):
"""
Gets the value of estimator or its default value.
"""
return self.getOrDefault(self.estimator)
+ @since("1.4.0")
def setEstimatorParamMaps(self, value):
"""
Sets the value of :py:attr:`estimatorParamMaps`.
@@ -170,12 +182,14 @@ class CrossValidator(Estimator):
self._paramMap[self.estimatorParamMaps] = value
return self
+ @since("1.4.0")
def getEstimatorParamMaps(self):
"""
Gets the value of estimatorParamMaps or its default value.
"""
return self.getOrDefault(self.estimatorParamMaps)
+ @since("1.4.0")
def setEvaluator(self, value):
"""
Sets the value of :py:attr:`evaluator`.
@@ -183,12 +197,14 @@ class CrossValidator(Estimator):
self._paramMap[self.evaluator] = value
return self
+ @since("1.4.0")
def getEvaluator(self):
"""
Gets the value of evaluator or its default value.
"""
return self.getOrDefault(self.evaluator)
+ @since("1.4.0")
def setNumFolds(self, value):
"""
Sets the value of :py:attr:`numFolds`.
@@ -196,6 +212,7 @@ class CrossValidator(Estimator):
self._paramMap[self.numFolds] = value
return self
+ @since("1.4.0")
def getNumFolds(self):
"""
Gets the value of numFolds or its default value.
@@ -231,7 +248,15 @@ class CrossValidator(Estimator):
bestModel = est.fit(dataset, epm[bestIndex])
return CrossValidatorModel(bestModel)
+ @since("1.4.0")
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
+ """
if extra is None:
extra = dict()
newCV = Params.copy(self, extra)
@@ -246,6 +271,8 @@ class CrossValidator(Estimator):
class CrossValidatorModel(Model):
"""
Model from k-fold cross validation.
+
+ .. versionadded:: 1.4.0
"""
def __init__(self, bestModel):
@@ -256,6 +283,7 @@ class CrossValidatorModel(Model):
def _transform(self, dataset):
return self.bestModel.transform(dataset)
+ @since("1.4.0")
def copy(self, extra=None):
"""
Creates a copy of this instance with a randomly generated uid
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org