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

    https://github.com/apache/spark/pull/3833#discussion_r23954570
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/classification/LogisticRegression.scala
 ---
    @@ -18,30 +18,42 @@
     package org.apache.spark.mllib.classification
     
     import org.apache.spark.annotation.Experimental
    -import org.apache.spark.mllib.linalg.Vector
    +import org.apache.spark.mllib.linalg.BLAS.dot
    +import org.apache.spark.mllib.linalg.{DenseVector, Vector}
     import org.apache.spark.mllib.optimization._
     import org.apache.spark.mllib.regression._
    -import org.apache.spark.mllib.util.DataValidators
    +import org.apache.spark.mllib.util.{DataValidators, MLUtils}
     import org.apache.spark.rdd.RDD
     
     /**
    - * Classification model trained using Logistic Regression.
    + * Classification model trained using Multinomial/Binary Logistic 
Regression.
      *
      * @param weights Weights computed for every feature.
    - * @param intercept Intercept computed for this model.
    + * @param intercept Intercept computed for this model. (Only used in 
Binary Logistic Regression.
    + *                  In Multinomial Logistic Regression, the intercepts 
will not be a single values,
    + *                  so the intercepts will be part of the weights.)
    + * @param featureSize the dimension of the features
    + * @param numClasses the number of possible outcomes for k classes 
classification problem in
    + *                   Multinomial Logistic Regression. By default, it is 
binary logistic regression
    + *                   so numClasses will be set to 2.
      */
     class LogisticRegressionModel (
         override val weights: Vector,
    -    override val intercept: Double)
    +    override val intercept: Double,
    +    val featureSize: Int,
    +    val numClasses: Int)
       extends GeneralizedLinearModel(weights, intercept) with 
ClassificationModel with Serializable {
     
    +  def this(weights: Vector, intercept: Double, featureSize: Int) =
    --- End diff --
    
    We need to keep the original constructor to be backward compatible.
    
    ~~~
    def this(weights: Vector, intercept: Double) = this(weights, intercept, 
weights.size, 2)
    ~~~
    
    `this(weights, intercept, featureSize)` doesn't seem necessary to me.


---
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