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
Prev Previous commit
Next Next commit
fix nits
  • Loading branch information
zhengruifeng committed Jan 5, 2017
commit 2bc4e29813499a8643b30d14538ecf1431ff1f55
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String
setDefault(regParam -> 0.0)

/**
* Set if we should fit the intercept
* Set if we should fit the intercept.
* Default is true.
*
* @group setParam
Expand Down Expand Up @@ -256,10 +256,10 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String
val rawYStd = math.sqrt(ySummarizer.variance(0))
if (rawYStd == 0.0) {
if ($(fitIntercept) || yMean == 0.0) {
// If the rawYStd is zero and fitIntercept=true, then the intercept is yMean with
// If the rawYStd==0 and fitIntercept==true, then the intercept is yMean with
// zero coefficient; as a result, training is not needed.
// Also, if yMean==0 and rawYStd==0, all the coefficients are zero regardless of
// the fitIntercept
// the fitIntercept.
if (yMean == 0.0) {
logWarning(s"Mean and standard deviation of the label are zero, so the coefficients " +
s"and the intercept will all be zero; as a result, training is not needed.")
Expand Down