Skip to content
Closed
Changes from all commits
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
11 changes: 5 additions & 6 deletions python/pyspark/ml/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,29 +1303,28 @@ class GeneralizedLinearRegression(JavaEstimator, HasLabelCol, HasFeaturesCol, Ha
@keyword_only
def __init__(self, labelCol="label", featuresCol="features", predictionCol="prediction",
family="gaussian", link=None, fitIntercept=True, maxIter=25, tol=1e-6,
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol=""):
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol=None):
"""
__init__(self, labelCol="label", featuresCol="features", predictionCol="prediction", \
family="gaussian", link=None, fitIntercept=True, maxIter=25, tol=1e-6, \
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol="")
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol=None)
"""
super(GeneralizedLinearRegression, self).__init__()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.regression.GeneralizedLinearRegression", self.uid)
self._setDefault(family="gaussian", maxIter=25, tol=1e-6, regParam=0.0, solver="irls",
linkPredictionCol="")
self._setDefault(family="gaussian", maxIter=25, tol=1e-6, regParam=0.0, solver="irls")
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we should then make the default in __init__ and setParams be None rather than ""?

Copy link
Member Author

@viirya viirya May 20, 2016

Choose a reason for hiding this comment

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

I was not sure about this. So just following other similar params in other classes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. Let me update it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the setDefault change you have is fine - I mean the default
constructor param
On Fri, 20 May 2016 at 11:37, Liang-Chi Hsieh [email protected]
wrote:

In python/pyspark/ml/regression.py
#13220 (comment):

@@ -1312,8 +1312,7 @@ def init(self, labelCol="label", featuresCol="features", predictionCol="pred
super(GeneralizedLinearRegression, self).init()
self._java_obj = self._new_java_obj(
"org.apache.spark.ml.regression.GeneralizedLinearRegression", self.uid)

  •    self._setDefault(family="gaussian", maxIter=25, tol=1e-6, regParam=0.0, solver="irls",
    
  •                     linkPredictionCol="")
    
  •    self._setDefault(family="gaussian", maxIter=25, tol=1e-6, regParam=0.0, solver="irls")
    

I was not sure about this. So just following other similar params in other
classes.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/apache/spark/pull/13220/files/132753838a1424f09d85003a4436bb7ce0bd7774#r64014350

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea. Updated. Thanks.

kwargs = self.__init__._input_kwargs
self.setParams(**kwargs)

@keyword_only
@since("2.0.0")
def setParams(self, labelCol="label", featuresCol="features", predictionCol="prediction",
family="gaussian", link=None, fitIntercept=True, maxIter=25, tol=1e-6,
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol=""):
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol=None):
"""
setParams(self, labelCol="label", featuresCol="features", predictionCol="prediction", \
family="gaussian", link=None, fitIntercept=True, maxIter=25, tol=1e-6, \
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol="")
regParam=0.0, weightCol=None, solver="irls", linkPredictionCol=None)
Sets params for generalized linear regression.
"""
kwargs = self.setParams._input_kwargs
Expand Down