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

Model update propagation during prediction in Streaming Regression

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.1, 1.4.0
    • DStreams, MLlib
    • None

    Description

      During streaming regression analyses (Streaming Linear Regression and Streaming Logistic Regression), model updates based on training data are not being reflected in subsequent calls to predictOn or predictOnValues, despite updates themselves occurring successfully. It may be due to recent changes to model declaration, and I have a working fix prepared to be submitted ASAP (alongside expanded test coverage).

      A temporary workaround is to retrieve and use the updated model within a foreachRDD, as in:

      model.trainOn(trainingData)
      testingData.foreachRDD{ rdd =>
          val latest = model.latestModel()
          val predictions = rdd.map(lp => latest.predict(lp.features))
          ...print or other side effects...
      }
      

      Or within a transform, as in:

      model.trainOn(trainingData)
      val predictions = testingData.transform { rdd =>
            val latest = model.latestModel()
            rdd.map(lp => (lp.label, latest.predict(lp.features)))
      }
      

      Note that this does not affect Streaming KMeans, which works as expected for combinations of training and prediction.

      Attachments

        Activity

          People

            freeman-lab Jeremy Freeman
            freeman-lab Jeremy Freeman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: