aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml/param/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/pyspark/ml/param/__init__.py')
-rw-r--r--python/pyspark/ml/param/__init__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/python/pyspark/ml/param/__init__.py b/python/pyspark/ml/param/__init__.py
index 2e0c63cb47..35c9b776a3 100644
--- a/python/pyspark/ml/param/__init__.py
+++ b/python/pyspark/ml/param/__init__.py
@@ -18,6 +18,7 @@
from abc import ABCMeta
import copy
+from pyspark import since
from pyspark.ml.util import Identifiable
@@ -27,6 +28,8 @@ __all__ = ['Param', 'Params']
class Param(object):
"""
A param with self-contained documentation.
+
+ .. versionadded:: 1.3.0
"""
def __init__(self, parent, name, doc):
@@ -56,6 +59,8 @@ class Params(Identifiable):
"""
Components that take parameters. This also provides an internal
param map to store parameter values attached to the instance.
+
+ .. versionadded:: 1.3.0
"""
__metaclass__ = ABCMeta
@@ -72,6 +77,7 @@ class Params(Identifiable):
self._params = None
@property
+ @since("1.3.0")
def params(self):
"""
Returns all params ordered by name. The default implementation
@@ -83,6 +89,7 @@ class Params(Identifiable):
[getattr(self, x) for x in dir(self) if x != "params"]))
return self._params
+ @since("1.4.0")
def explainParam(self, param):
"""
Explains a single param and returns its name, doc, and optional
@@ -100,6 +107,7 @@ class Params(Identifiable):
valueStr = "(" + ", ".join(values) + ")"
return "%s: %s %s" % (param.name, param.doc, valueStr)
+ @since("1.4.0")
def explainParams(self):
"""
Returns the documentation of all params with their optionally
@@ -107,6 +115,7 @@ class Params(Identifiable):
"""
return "\n".join([self.explainParam(param) for param in self.params])
+ @since("1.4.0")
def getParam(self, paramName):
"""
Gets a param by its name.
@@ -117,6 +126,7 @@ class Params(Identifiable):
else:
raise ValueError("Cannot find param with name %s." % paramName)
+ @since("1.4.0")
def isSet(self, param):
"""
Checks whether a param is explicitly set by user.
@@ -124,6 +134,7 @@ class Params(Identifiable):
param = self._resolveParam(param)
return param in self._paramMap
+ @since("1.4.0")
def hasDefault(self, param):
"""
Checks whether a param has a default value.
@@ -131,6 +142,7 @@ class Params(Identifiable):
param = self._resolveParam(param)
return param in self._defaultParamMap
+ @since("1.4.0")
def isDefined(self, param):
"""
Checks whether a param is explicitly set by user or has
@@ -138,6 +150,7 @@ class Params(Identifiable):
"""
return self.isSet(param) or self.hasDefault(param)
+ @since("1.4.0")
def hasParam(self, paramName):
"""
Tests whether this instance contains a param with a given
@@ -146,6 +159,7 @@ class Params(Identifiable):
param = self._resolveParam(paramName)
return param in self.params
+ @since("1.4.0")
def getOrDefault(self, param):
"""
Gets the value of a param in the user-supplied param map or its
@@ -157,6 +171,7 @@ class Params(Identifiable):
else:
return self._defaultParamMap[param]
+ @since("1.4.0")
def extractParamMap(self, extra=None):
"""
Extracts the embedded default param values and user-supplied
@@ -175,6 +190,7 @@ class Params(Identifiable):
paramMap.update(extra)
return paramMap
+ @since("1.4.0")
def copy(self, extra=None):
"""
Creates a copy of this instance with the same uid and some