[ 
https://issues.apache.org/jira/browse/MAHOUT-1314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13825157#comment-13825157
 ] 

Suneel Marthi edited comment on MAHOUT-1314 at 11/18/13 8:14 AM:
-----------------------------------------------------------------

This issue is fixed. Fixing this issue led to the next issue. 

The following code in StreamimgKMeansThread.call() is wrong:

{Code}

    Iterator<Centroid> datapointsIterator = datapoints.iterator();
    if (estimateDistanceCutoff == 
StreamingKMeansDriver.INVALID_DISTANCE_CUTOFF) {
      List<Centroid> estimatePoints = 
Lists.newArrayListWithExpectedSize(NUM_ESTIMATE_POINTS);
      while (datapointsIterator.hasNext() && estimatePoints.size() < 
NUM_ESTIMATE_POINTS) {
        estimatePoints.add(datapointsIterator.next());
      }
      estimateDistanceCutoff = 
ClusteringUtils.estimateDistanceCutoff(estimatePoints, 
searcher.getDistanceMeasure());
    }

    StreamingKMeans clusterer = new StreamingKMeans(searcher, numClusters, 
estimateDistanceCutoff);
    while (datapointsIterator.hasNext()) {
      clusterer.cluster(datapointsIterator.next());
    }

{Code}

On the second loop thru of datapointsIterator, there are no datapoints to 
iterate and the job fails with an IllegalArgumentException.



was (Author: smarthi):
This issue is fixed. Fixing this issue led to the next issue. 

The following code in StreamimgKMeansThread.call() is wrong:

{Code}

    Iterator<Centroid> datapointsIterator = datapoints.iterator();
    if (estimateDistanceCutoff == 
StreamingKMeansDriver.INVALID_DISTANCE_CUTOFF) {
      List<Centroid> estimatePoints = 
Lists.newArrayListWithExpectedSize(NUM_ESTIMATE_POINTS);
      while (datapointsIterator.hasNext() && estimatePoints.size() < 
NUM_ESTIMATE_POINTS) {
        estimatePoints.add(datapointsIterator.next());
      }
      estimateDistanceCutoff = 
ClusteringUtils.estimateDistanceCutoff(estimatePoints, 
searcher.getDistanceMeasure());
    }

    StreamingKMeans clusterer = new StreamingKMeans(searcher, numClusters, 
estimateDistanceCutoff);
    while (datapointsIterator.hasNext()) {
      clusterer.cluster(datapointsIterator.next());
    }

{Code}

On the second iteration, there are no datapoints to iterate and the job fails 
with an IllegalArgumentException.


> StreamingKMeansReducer throws NullPointerException when 
> REDUCE_STREAMING_KMEANS is set to true
> ----------------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-1314
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1314
>             Project: Mahout
>          Issue Type: Bug
>          Components: Clustering
>    Affects Versions: 0.8
>            Reporter: Adi Haviv
>            Assignee: Suneel Marthi
>             Fix For: 0.9
>
>         Attachments: MAHOUT-1314.patch
>
>
> when REDUCE_STREAMING_KMEANS option is set to true (-rskm) the reducer fails 
> with NullPointerException.
> the problem is in the reduce method itself: on line 60 ( return 
> input.getCentroid(); )
> it should be input.getCentroid().clone();
> similar to line 81.
> full stack trace: 
> java.lang.NullPointerException
>       at 
> com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
>       at 
> org.apache.mahout.math.random.WeightedThing.<init>(WeightedThing.java:31)
>       at 
> org.apache.mahout.math.neighborhood.BruteSearch.searchFirst(BruteSearch.java:133)
>       at 
> org.apache.mahout.clustering.ClusteringUtils.estimateDistanceCutoff(ClusteringUtils.java:100)
>       at 
> org.apache.mahout.clustering.streaming.mapreduce.StreamingKMeansThread.call(StreamingKMeansThread.java:64)
>       at 
> org.apache.mahout.clustering.streaming.mapreduce.StreamingKMeansReducer.reduce(StreamingKMeansReducer.java:66)
>       at 
> org.apache.mahout.clustering.streaming.mapreduce.StreamingKMeansReducer.reduce(StreamingKMeansReducer.java:1)
>       at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:176)
>       at 
> org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:650)
>       at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:418)
>       at 
> org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:260)
> it happens every time the REDUCE_STREAMING_KMEANS is set to true.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to