Github user MechCoder commented on the pull request:

    https://github.com/apache/spark/pull/6499#issuecomment-107042488
  
    @mengxr @freeman-lab 
    
    I would really like some help here. The `StreamingKMeansModel` works as it 
is supposed to. I have added doc tests for those.
    
    However, the `trainOn` method of `StreamingKMeans' 
(https://github.com/apache/spark/pull/6499/files#diff-21c55b407050d37f67a2919470e047ebR373)
 seems to run indefinitely. I printed 'rdd.collect()' under `if rdd`, it seems 
the foreachRDD continues even after all the batches in the dstream are 
exhausted.
    
    A small example to reproduce.
    
        from pyspark.mllib.clustering import StreamingKMeans, 
StreamingKMeansModel
        stk = StreamingKMeans()
        initCenters = [[0.0, 0.0], [1.0, 1.0]] 
        weights = [1.0, 1.0]
        stk.setInitialCenters(initCenters, weights)
        dv1, dv2, dv3, dv4 = [-0.1, -0.1], [0.1, 0.1], [1.1, 1.1], [0.9, 0.9]
        dvc = [[dv1, dv3], [dv2, dv4]]
        dvc = [sc.parallelize(i, 1) for i in dvc]
        ssc = StreamingContext(sc, 2.0)
        input_stream = ssc.queueStream(dvc)
        stk.trainOn(input_stream)
        ssc.start()
    
    This does not seem to terminate.


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