Skip to content

Commit 76415e8

Browse files
committed
reverted convergenceTol to tol
1 parent af62f4b commit 76415e8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

mllib/src/main/scala/org/apache/spark/ml/param/shared/sharedParams.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,18 @@ private[ml] trait HasElasticNetParam extends Params {
265265
}
266266

267267
/**
268-
* (private[ml]) Trait for shared param convergenceTol.
268+
* (private[ml]) Trait for shared param tol.
269269
*/
270-
private[ml] trait HasConvergenceTol extends Params {
270+
private[ml] trait HasTol extends Params {
271271

272272
/**
273273
* Param for the convergence tolerance for iterative algorithms.
274274
* @group param
275275
*/
276-
final val convergenceTol: DoubleParam = new DoubleParam(this, "convergenceTol", "the convergence tolerance for iterative algorithms")
276+
final val tol: DoubleParam = new DoubleParam(this, "tol", "the convergence tolerance for iterative algorithms")
277277

278278
/** @group getParam */
279-
final def getConvergenceTol: Double = getOrDefault(convergenceTol)
279+
final def getTol: Double = getOrDefault(tol)
280280
}
281281

282282
/**

mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import breeze.optimize.{CachedDiffFunction, DiffFunction}
2525

2626
import org.apache.spark.annotation.AlphaComponent
2727
import org.apache.spark.ml.param.{Params, ParamMap}
28-
import org.apache.spark.ml.param.shared.{HasConvergenceTol, HasElasticNetParam, HasMaxIter,
28+
import org.apache.spark.ml.param.shared.{HasTol, HasElasticNetParam, HasMaxIter,
2929
HasRegParam}
3030
import org.apache.spark.mllib.stat.MultivariateOnlineSummarizer
3131
import org.apache.spark.mllib.linalg.{Vector, Vectors}
@@ -41,7 +41,7 @@ import org.apache.spark.Logging
4141
* Params for linear regression.
4242
*/
4343
private[regression] trait LinearRegressionParams extends RegressorParams
44-
with HasRegParam with HasElasticNetParam with HasMaxIter with HasConvergenceTol
44+
with HasRegParam with HasElasticNetParam with HasMaxIter with HasTol
4545

4646
/**
4747
* :: AlphaComponent ::
@@ -94,8 +94,8 @@ class LinearRegression extends Regressor[Vector, LinearRegression, LinearRegress
9494
* Default is 1E-6.
9595
* @group setParam
9696
*/
97-
def setTol(value: Double): this.type = set(convergenceTol, value)
98-
setDefault(convergenceTol -> 1E-6)
97+
def setTol(value: Double): this.type = set(tol, value)
98+
setDefault(tol -> 1E-6)
9999

100100
override protected def train(dataset: DataFrame, paramMap: ParamMap): LinearRegressionModel = {
101101
// Extract columns from data. If dataset is persisted, do not persist instances.
@@ -144,10 +144,10 @@ class LinearRegression extends Regressor[Vector, LinearRegression, LinearRegress
144144
featuresStd, featuresMean, effectiveL2RegParam)
145145

146146
val optimizer = if (paramMap(elasticNetParam) == 0.0 || effectiveRegParam == 0.0) {
147-
new BreezeLBFGS[BDV[Double]](paramMap(maxIter), 10, paramMap(convergenceTol))
147+
new BreezeLBFGS[BDV[Double]](paramMap(maxIter), 10, paramMap(tol))
148148
} else {
149149
new BreezeOWLQN[Int, BDV[Double]](paramMap(maxIter), 10, effectiveL1RegParam,
150-
paramMap(convergenceTol))
150+
paramMap(tol))
151151
}
152152

153153
val initialWeights = Vectors.zeros(numFeatures)

0 commit comments

Comments
 (0)