Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions python/pyspark/ml/param/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def getOrDefault(self, param):
return self._defaultParamMap[param]

@since("1.4.0")
def extractParamMap(self, extra=None):
def extractParamMap(self, extra=None, default=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document this new param

"""
Extracts the embedded default param values and user-supplied
values, and then merges them with extra values from input into
Expand All @@ -371,7 +371,8 @@ def extractParamMap(self, extra=None):
if extra is None:
extra = dict()
paramMap = self._defaultParamMap.copy()
paramMap.update(self._paramMap)
if not default:
paramMap.update(self._paramMap)
paramMap.update(extra)
return paramMap

Expand Down Expand Up @@ -463,7 +464,7 @@ def _setDefault(self, **kwargs):
self._defaultParamMap[p] = value
return self

def _copyValues(self, to, extra=None):
def _copyValues(self, to, extra=None, default=False):
"""
Copies param values from this instance to another instance for
params shared by them.
Expand All @@ -474,10 +475,11 @@ def _copyValues(self, to, extra=None):
"""
if extra is None:
extra = dict()
paramMap = self.extractParamMap(extra)
paramMap = self.extractParamMap(extra, default)
for p in self.params:
if p in paramMap and to.hasParam(p.name):
to._set(**{p.name: paramMap[p]})
to.set(**{'uid': self.uid})
return to

def _resetUid(self, newUid):
Expand Down