Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1862#discussion_r16023020
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
 ---
    @@ -188,3 +188,54 @@ object LogisticRegressionWithSGD {
         train(input, numIterations, 1.0, 1.0)
       }
     }
    +
    +/**
    + * Train a classification model for Logistic Regression using 
Limited-memory BFGS.
    + * NOTE: Labels used in Logistic Regression should be {0, 1}
    + */
    +class LogisticRegressionWithLBFGS private (
    +    private var convergenceTol: Double,
    +    private var maxNumIterations: Int,
    +    private var regParam: Double)
    +  extends GeneralizedLinearAlgorithm[LogisticRegressionModel] with 
Serializable {
    +
    +  private val gradient = new LogisticGradient()
    +  private val updater = new SimpleUpdater()
    +  // Have to be lazy since users can change the parameters after the class 
is created.
    +  // PS, after the first train, the optimizer variable will be computed, 
so the parameters
    +  // can not be changed anymore.
    +  override lazy val optimizer = new LBFGS(gradient, updater)
    +    .setNumCorrections(10)
    +    .setConvergenceTol(convergenceTol)
    +    .setMaxNumIterations(maxNumIterations)
    +    .setRegParam(regParam)
    +
    +  override protected val validators = 
List(DataValidators.binaryLabelValidator)
    +
    +  /**
    +   * Construct a LogisticRegression object with default parameters
    +   */
    +  def this() = this(1E-4, 100, 0.0)
    +
    +  /**
    +   * Set the convergence tolerance of iterations for L-BFGS. Default 1E-4.
    +   * Smaller value will lead to higher accuracy with the cost of more 
iterations.
    +   */
    +  def setConvergenceTol(tolerance: Double): this.type = {
    --- End diff --
    
    `tolerance` -> `convergenceTol`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to