Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-1213

loss function error of logistic loss

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.9.0
    • MLlib

    Description

      There might be a error in incubator-spark/mllib/src/main/scala/org/apache/spark/mllib/optimizatio/Gradient.scala

      The loss function of class LogisticGradient might be wrong.

      The original one is :
      val loss =
      if (margin > 0)

      { math.log(1 + math.exp(0 - margin)) }

      else

      { math.log(1 + math.exp(margin)) - margin }

      But when we use this kind of loss function, we will find that the loss is increasing when optimizing, such as LogisticRegressionWithSGD.

      I think it should be something like this:

      val loss =
      if (label > 0)

      { math.log(1 + math.exp(margin)) }

      else

      { math.log(1 + math.exp(margin)) - margin }

      I tested the loss function. It works well.

      Attachments

        Activity

          People

            Unassigned Unassigned
            xusen Xusen Yin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: