aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml/tuning.py
diff options
context:
space:
mode:
authorMechCoder <manojkumarsivaraj334@gmail.com>2015-08-14 12:46:05 -0700
committerXiangrui Meng <meng@databricks.com>2015-08-14 12:46:05 -0700
commitffa05c84fe75663fc33f3d954d1cb1e084ab3280 (patch)
treeeb5599d7c52bf7ddcd72d340952bca83e169c2d0 /python/pyspark/ml/tuning.py
parentece00566e4d5f38585f2810bef38e526cae7d25e (diff)
downloadspark-ffa05c84fe75663fc33f3d954d1cb1e084ab3280.tar.gz
spark-ffa05c84fe75663fc33f3d954d1cb1e084ab3280.tar.bz2
spark-ffa05c84fe75663fc33f3d954d1cb1e084ab3280.zip
[SPARK-9828] [PYSPARK] Mutable values should not be default arguments
Author: MechCoder <manojkumarsivaraj334@gmail.com> Closes #8110 from MechCoder/spark-9828.
Diffstat (limited to 'python/pyspark/ml/tuning.py')
-rw-r--r--python/pyspark/ml/tuning.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/pyspark/ml/tuning.py b/python/pyspark/ml/tuning.py
index 0bf988fd72..dcfee6a317 100644
--- a/python/pyspark/ml/tuning.py
+++ b/python/pyspark/ml/tuning.py
@@ -227,7 +227,9 @@ class CrossValidator(Estimator):
bestModel = est.fit(dataset, epm[bestIndex])
return CrossValidatorModel(bestModel)
- def copy(self, extra={}):
+ def copy(self, extra=None):
+ if extra is None:
+ extra = dict()
newCV = Params.copy(self, extra)
if self.isSet(self.estimator):
newCV.setEstimator(self.getEstimator().copy(extra))
@@ -250,7 +252,7 @@ class CrossValidatorModel(Model):
def _transform(self, dataset):
return self.bestModel.transform(dataset)
- def copy(self, extra={}):
+ def copy(self, extra=None):
"""
Creates a copy of this instance with a randomly generated uid
and some extra params. This copies the underlying bestModel,
@@ -259,6 +261,8 @@ class CrossValidatorModel(Model):
:param extra: Extra parameters to copy to the new instance
:return: Copy of this instance
"""
+ if extra is None:
+ extra = dict()
return CrossValidatorModel(self.bestModel.copy(extra))