code: def trainOn(self, dstream):
          
          self._validate(dstream)
  
          def update(rdd):
              self._model.update(rdd, self._decayFactor, self._timeUnit)
  
          dstream.foreachRDD(update)
docs: Train the model on the incoming dstream.