Hi,

I am trying to solve a 2-class classification problem using Apache Mahout
NaiveBayes. I am using 0.5 version, but I am not able to pass a modified
custom feature vector to the train method.

here is a small snippet

**BayesParameters params = new BayesParameters();
  System.out.println("Setting parameters");
  params.setGramSize( 1 );
  params.set( "verbose", "true" );
  params.set( "classifierType", "bayes" );
  params.set( "defaultCat", "OTHER" );
  params.set( "encoding", "UTF-8" );
  params.set( "alpha_i", "1.0" );
  params.set( "dataSource", "hdfs" );
  params.set( "basePath", outputTrainingObjectPath );
  System.out.println("parameters set");
  try {

            Path input = new Path( trainPath);
            Path output = new Path(outputTrainingObjectPath);

            System.out.println("training starts");
            TrainClassifier.trainNaiveBayes( input,output,params);
  }catch(Exception e){
     e.printStackTrace();
}**

Is there a way to pass our own custom-generated features. I referred to Ap
ache Mahout in Action, it uses RandomAccessVectors as the custom-features,
but the *train* method of Naive Bayes is not designed to accept the custom
features it seems.

Thanks in advance.

Sabyasachi Upadhyay,
*Software Engineer*
*Quikr Technology,*
*Bangalore*
*Skype* - sabyasachi.upadhyay1
*Phone* - 9741263004

On Sun, Feb 1, 2015 at 2:15 AM, Sabyasachi Upadhyay <supadh...@quikr.com>
wrote:

> Hi,
>
> I am trying to solve a 2-class classification problem using Apache Mahout
> NaiveBayes. I am using 0.5 version, but I am not able to pass a modified
> custom feature vector to the train method.
>
> here is a small snippet
>
> **BayesParameters params = new BayesParameters();
>   System.out.println("Setting parameters");
>   params.setGramSize( 1 );
>   params.set( "verbose", "true" );
>   params.set( "classifierType", "bayes" );
>   params.set( "defaultCat", "OTHER" );
>   params.set( "encoding", "UTF-8" );
>   params.set( "alpha_i", "1.0" );
>   params.set( "dataSource", "hdfs" );
>   params.set( "basePath", outputTrainingObjectPath );
>   System.out.println("parameters set");
>   try {
>
>             Path input = new Path( trainPath);
>             Path output = new Path(outputTrainingObjectPath);
>
>             System.out.println("training starts");
>             TrainClassifier.trainNaiveBayes( input,output,params);
>   }catch(Exception e){
>      e.printStackTrace();
> }**
>
> Is there a way to pass our own custom-generated features. I referred to Ap
> ache Mahout in Action, it uses RandomAccessVectors as the custom-features,
> but the *train* method of Naive Bayes is not designed to accept the
> custom features it seems.
>
> Thanks in advance.
>
>
> Sabyasachi Upadhyay,
> *Software Engineer*
> *Quikr Technology,*
> *Bangalore*
> *Skype* - sabyasachi.upadhyay1
> *Phone* - 9741263004
>

Reply via email to