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

    https://github.com/apache/spark/pull/7884#discussion_r38586752
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
 ---
    @@ -499,22 +518,26 @@ class LogisticRegressionModel private[ml] (
      * corresponding joint dataset.
      */
     private[classification] class MultiClassSummarizer extends Serializable {
    -  private val distinctMap = new mutable.HashMap[Int, Long]
    +  private val distinctMap = new mutable.HashMap[Int, Double]
       private var totalInvalidCnt: Long = 0L
     
       /**
        * Add a new label into this MultilabelSummarizer, and update the 
distinct map.
        * @param label The label for this data point.
    +   * @param weight The weight of this sample.
        * @return This MultilabelSummarizer
        */
    -  def add(label: Double): this.type = {
    +  def add(label: Double, weight: Double = 1.0): this.type = {
    +    if (weight == 0.0) return this
    +    require(weight > 0.0, s"sample weight, ${weight} has to be >= 0.0")
    --- End diff --
    
    Move `require(...)` right after L530. This optimization is not very 
necessary.


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