0
我是apache mahout的新手。我正在嘗試使用Apache Mahout的FP增長算法來從Java運行它。這裏是我的代碼使用,在Eclipse中運行apache mahout FP增長時的java.lang.NullPointerException
FPGrowth<String> fp = new FPGrowth<String>();
FileLineIterable file = new FileLineIterable(new File(FPInputFileName));
int minSupport = 2;
int maxHeapSize = 50;
Writer writer = null;
StringOutputConverter output = new StringOutputConverter(new SequenceFileOutputCollector<Text,TopKStringPatterns>(writer));
String pattern = " "; //currently understood as splitter
try{
fp.generateTopKFrequentPatterns(new StringRecordIterator(file,pattern), fp.generateFList(new StringRecordIterator(file, pattern), minSupport), minSupport, maxHeapSize, null, output, null);
}catch(Exception err){
err.printStackTrace();
}
我面臨以下錯誤:
java.lang.NullPointerException
at org.apache.mahout.fpm.pfpgrowth.fpgrowth.FPGrowth.growth(FPGrowth.java:331)
at org.apache.mahout.fpm.pfpgrowth.fpgrowth.FPGrowth.fpGrowth(FPGrowth.java:211)
at org.apache.mahout.fpm.pfpgrowth.fpgrowth.FPGrowth.generateTopKFrequentPatterns(FPGrowth.java:302)
at org.apache.mahout.fpm.pfpgrowth.fpgrowth.FPGrowth.generateTopKFrequentPatterns(FPGrowth.java:174)
at myProgram.main(myProgram.java:96)
如何解讀?這是因爲作家設置爲空?請幫忙。
問候, psun