Skip to content

Commit eaed879

Browse files
committed
readd numFeatures
1 parent 0bd66b1 commit eaed879

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

python/pyspark/ml/param/_shared_params_code_gen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def get$Name(self):
9797
("inputCol", "input column name", None),
9898
("inputCols", "input column names", None),
9999
("outputCol", "output column name", None),
100+
("numFeatures", "number of features", None),
100101
("checkpointInterval", "checkpoint interval (>= 1)", None),
101102
("seed", "random seed", None),
102103
("tol", "the convergence tolerance for iterative algorithms", None),

python/pyspark/ml/param/shared.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,35 @@ def getOutputCol(self):
281281
return self.getOrDefault(self.outputCol)
282282

283283

284+
class HasNumFeatures(Params):
285+
"""
286+
Mixin for param numFeatures: number of features.
287+
"""
288+
289+
# a placeholder to make it appear in the generated doc
290+
numFeatures = Param(Params._dummy(), "numFeatures", "number of features")
291+
292+
def __init__(self):
293+
super(HasNumFeatures, self).__init__()
294+
#: param for number of features
295+
self.numFeatures = Param(self, "numFeatures", "number of features")
296+
if None is not None:
297+
self._setDefault(numFeatures=None)
298+
299+
def setNumFeatures(self, value):
300+
"""
301+
Sets the value of :py:attr:`numFeatures`.
302+
"""
303+
self.paramMap[self.numFeatures] = value
304+
return self
305+
306+
def getNumFeatures(self):
307+
"""
308+
Gets the value of numFeatures or its default value.
309+
"""
310+
return self.getOrDefault(self.numFeatures)
311+
312+
284313
class HasCheckpointInterval(Params):
285314
"""
286315
Mixin for param checkpointInterval: checkpoint interval (>= 1).

0 commit comments

Comments
 (0)