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

jayghost commented on MAHOUT-1034:
----------------------------------

Thanks, Sean Owen, I find there is a WARN driver.MahoutDriver: No trainnb.props 
found on classpath, will use command-line arguments only. Does it mean the 
org.apache.mahout.classifier.naivebayes.training.WeightsMapper.numLabels should 
be set in the trainnb.props?

And I see the source file of 
org.apache.mahout.classifier.naivebayes.training.WeightsMapper:
{
public class WeightsMapper extends Mapper<IntWritable, VectorWritable, Text, 
VectorWritable>
{
  static final String NUM_LABELS = WeightsMapper.class.getName() + ".numLabels";
  private Vector weightsPerFeature;
  private Vector weightsPerLabel;

  protected void setup(Mapper<IntWritable, VectorWritable, Text, 
VectorWritable>.Context ctx)
    throws IOException, InterruptedException
  {
    super.setup(ctx);
    int numLabels = Integer.parseInt(ctx.getConfiguration().get(NUM_LABELS));
    Preconditions.checkArgument(numLabels > 0);
    this.weightsPerLabel = new RandomAccessSparseVector(numLabels);
  }
......
}
The error is throwed at "Preconditions.checkArgument(numLabels > 0)".

But how to set the numLabels? I think I must miss something.
                
> ERROR in Navie Bayes Training(trainnb)
> --------------------------------------
>
>                 Key: MAHOUT-1034
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-1034
>             Project: Mahout
>          Issue Type: Bug
>          Components: Classification
>    Affects Versions: 0.7
>         Environment: Ubuntu 11.04
>            Reporter: Leting Wu
>            Priority: Critical
>
> When run either examples/classify-20newsgrouops.sh or ash-email-examples.sh, 
> trainnb always fails:
> {noformat}
> INFO mapred.JobClient: Task Id : attempt_201206281546_0003_m_000000_0, Status 
> : FAILED
> java.lang.IllegalArgumentException
>       at 
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:72)
>       at 
> org.apache.mahout.classifier.naivebayes.training.WeightsMapper.setup(WeightsMapper.java:42)
>       at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:142)
>       at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
>       at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
>       at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at javax.security.auth.Subject.doAs(Subject.java:396)
>       at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1177)
>       at org.apache.hadoop.mapred.Child.main(Child.java:264)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to