我正在学习Mahout并阅读"Mahout in Action".
当我尝试在第7章SimpleKMeansClustering.java中运行示例代码时,弹出了一个异常:
线程"main"中的异常java.io.IOException:错误的值类:0.0:null不是org.apache.hadoop.io.SequenceFile $ Reader.next中的类org.apache.mahout.clustering.WeightedPropertyVectorWritable(SequenceFile.java: 1874)在SimpleKMeansClustering.main(SimpleKMeansClustering.java:95)
我在mahout-0.5上成功了这个代码,但在mahout-0.6上我看到了这个异常.即使我将目录名从clusters-0更改为clusters-0-final,我仍然面临此异常.
KMeansDriver.run(conf, vectors, new Path(canopyCentroids, "clusters-0-final"), clusterOutput, new TanimotoDistanceMeasure(), 0.01, 20, true, false);//First, I changed this path.
SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path("output/clusters/clusteredPoints/part-m-00000"), conf);//I double checked this folder and filename.
IntWritable key = new IntWritable();
WeightedVectorWritable value = new WeightedVectorWritable();
int i=0;
while(reader.next(key, value)) {
System.out.println(value.toString() + " belongs to cluster " + key.toString());
i++;
}
System.out.println(i);
reader.close();
Run Code Online (Sandbox Code Playgroud)
有没有人对这个例外有任何想法?我一直试图解决它很长时间,并没有任何想法.互联网上的消息来源很少.
提前致谢