Skip to content

Commit 30a743d

Browse files
committed
address comments
1 parent c0586bd commit 30a743d

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

python/pyspark/ml/classification.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,12 +1179,12 @@ class GBTClassifierParams(GBTParams, HasVarianceImpurity):
11791179
"Supported options: " + ", ".join(supportedLossTypes),
11801180
typeConverter=TypeConverters.toString)
11811181

1182-
@since("3.0.0")
1183-
def setLossType(self, value):
1182+
@since("1.4.0")
1183+
def getLossType(self):
11841184
"""
1185-
Sets the value of :py:attr:`lossType`.
1185+
Gets the value of lossType or its default value.
11861186
"""
1187-
return self._set(lossType=value)
1187+
return self.getOrDefault(self.lossType)
11881188

11891189

11901190
@inherit_doc
@@ -1311,6 +1311,13 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
13111311
def _create_model(self, java_model):
13121312
return GBTClassificationModel(java_model)
13131313

1314+
@since("1.4.0")
1315+
def setLossType(self, value):
1316+
"""
1317+
Sets the value of :py:attr:`lossType`.
1318+
"""
1319+
return self._set(lossType=value)
1320+
13141321
@since("2.4.0")
13151322
def setFeatureSubsetStrategy(self, value):
13161323
"""

python/pyspark/ml/regression.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,6 @@ class GBTParams(TreeEnsembleParams, HasMaxIter, HasStepSize, HasValidationIndica
727727
"This parameter is ignored when fit without validation is used.",
728728
typeConverter=TypeConverters.toFloat)
729729

730-
@since("3.0.0")
731-
def setValidationTol(self, value):
732-
"""
733-
Sets the value of :py:attr:`validationTol`.
734-
"""
735-
return self._set(validationTol=value)
736-
737730
@since("3.0.0")
738731
def getValidationTol(self):
739732
"""
@@ -757,11 +750,11 @@ class GBTRegressorParams(GBTParams, TreeRegressorParams):
757750
typeConverter=TypeConverters.toString)
758751

759752
@since("1.4.0")
760-
def setLossType(self, value):
753+
def getLossType(self):
761754
"""
762-
Sets the value of :py:attr:`lossType`.
755+
Gets the value of lossType or its default value.
763756
"""
764-
return self._set(lossType=value)
757+
return self.getOrDefault(self.lossType)
765758

766759

767760
@inherit_doc
@@ -1187,6 +1180,13 @@ def setParams(self, featuresCol="features", labelCol="label", predictionCol="pre
11871180
def _create_model(self, java_model):
11881181
return GBTRegressionModel(java_model)
11891182

1183+
@since("1.4.0")
1184+
def setLossType(self, value):
1185+
"""
1186+
Sets the value of :py:attr:`lossType`.
1187+
"""
1188+
return self._set(lossType=value)
1189+
11901190
@since("2.4.0")
11911191
def setFeatureSubsetStrategy(self, value):
11921192
"""

0 commit comments

Comments
 (0)