调试mahout逻辑回归

时间:2012-11-15 20:25:04

标签: hadoop mahout

我是mahout的新手..我正在尝试这里列出的标准“甜甜圈”示例:

http://imiloainf.wordpress.com/2011/11/02/mahout-logistic-regression/

所以这个例子就像一个魅力。

但是当我尝试在我的数据集上实现它时(whcih是一个巨大的数据集)它不起作用。

数据集在一个csv文件中..一切都相同,除了它有很多功能(~100)并且是1TB文件。

我收到此错误。

 bin/mahout trainlogistic  --input /path/mahout_input/complete/input.csv \
--output mahoutmodel --target default --categories 2 --predictors O1 E1 I1 \
 --types numeric --features 30 --passes 100 --rate 50
Running on hadoop, using HADOOP_HOME=/opt/mapr/hadoop/hadoop-0.20.2
No HADOOP_CONF_DIR set, using /opt/mapr/hadoop/hadoop-0.20.2/conf
Exception in thread "main" java.lang.NullPointerException
        at org.apache.mahout.classifier.sgd.CsvRecordFactory.firstLine(CsvRecordFactory.java:167)
        at org.apache.mahout.classifier.sgd.TrainLogistic.main(TrainLogistic.java:75)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.ProgramDriver$ProgramDescription.invoke(ProgramDriver.java:68)
        at org.apache.hadoop.util.ProgramDriver.driver(ProgramDriver.java:139)
        at org.apache.mahout.driver.MahoutDriver.main(MahoutDriver.java:187)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:186)

我做错了什么?

你如何调试这个......错误是什么?

由于

3 个答案:

答案 0 :(得分:3)

我的猜测是你的输入不存在或是空的。我会检查/path/mahout_input/complete/input.csv是不是你的意思。

答案 1 :(得分:3)

检查输入路径或确保第一行输入路径的值为""只喜欢" x1"," x2"," x3"," lablel" ..等等

答案 2 :(得分:0)

也发生在我身上。

我的错是绕过了一个不正确的--target参数,这个参数在列中不存在。特别是我的标题行是

myColumn1,myColumn2,myColumn3

我的命令行是

mahout trainlogistic --input ./input.csv --output ./logistic_model
- target myMisTypedColumn1 --predictors myColumn2 myColumn3 --types w w w --features 2 --passses 100 --rate 50 --categories 2

另一个提示是:不要使用“(引号)或长列名称,所以你应该避免头疼”“mahout不喜欢我的专栏名称吗?”等等。

作为对MAHOUT的反馈:错误信息很糟糕。我们永远不应该在这样一个有前途的框架中看到“NullPointerException”。