0

I am trying to learn Machine Learning. In case of Information Extraction, save files are getting populated properly with data. But Number of class level is 0 in NLPFeaturesData.save file and log is also sounds like

93 #numTrainingDocs
0 #numClasses
53738 #numNullLabelInstances
9006940 #totalFeatures
C:\...\learnedModels.save #modelFile
SVMLibSvmJava #learnerName
null #learnerExecutable
-c 0.7 -t 0 -m 100 -tau 0.4 #learnerParams

I have run the following code base. But generated "NLPFeatureData.save" file's all class level is 0. Could someone please help me where I went wrong in machine learning.

try{
// *****************  load Gate & it's plugin [ Load learning] ***********************************
System.setProperty("gate.home", "C:\\Program Files\\GATE_Developer_7.1"); 
 Gate.init();
 Gate.getCreoleRegister().registerDirectories(new File(Gate.getPluginsHome(), ANNIEConstants.PLUGIN_DIR).toURI().toURL());
 Gate.getCreoleRegister().registerDirectories(new URL(FILE_WORK_PATH+"/plugins/Learning"));

// ****************** Instantiate corpus and load training documents *****************************  
    gate.Corpus corpus = (Corpus) Factory.createResource("gate.corpora.CorpusImpl");
    FileFilter fileFilter = new FileFilter() {
public boolean accept(File pathname) {
// TODO Auto-generated method stub
return true;
}
};
corpus.populate(new URL(".../corpus"),fileFilter,"UTF-8",false);
Gate.getCreoleRegister().registerDirectories();
//Make a pipeline and add the corpus 
FeatureMap pfm = Factory.newFeatureMap(); 
pfm.put("corpus", corpus); 
pipeline = (gate.creole.SerialAnalyserController)gate.Factory.createResource("gate.creole.SerialAnalyserController", pfm); 
 initAnnie();

//*********************************  Configure with relations config file and learning api 
File configFile = new File("../learning-config.xml"); //Wherever it is 
RunMode mode = RunMode.TRAINING; //or TRAINING, or APPLICATION .. 
FeatureMap fm = Factory.newFeatureMap(); 
fm.put("configFileURL", configFile.toURI().toURL()); 
fm.put("learningMode", mode); 
gate.learning.LearningAPIMain learner = (gate.learning.LearningAPIMain)gate.Factory.createResource("gate.learning.LearningAPIMain", fm);
pipeline.add(learner); 
pipeline.execute();
}catch(Exception e){
e.printStackTrace();
}
}
private static void initAnnie() throws GateException {
       for(int i = 0; i < ANNIEConstants.PR_NAMES.length; i++) {
         FeatureMap params = Factory.newFeatureMap(); // use default parameters
         ProcessingResource pr = (ProcessingResource)
           Factory.createResource(ANNIEConstants.PR_NAMES[i], params);
         pipeline.add(pr);
       }
}     
abhijit nag
  • 451
  • 6
  • 24
  • am I clear with my question. Let me know if any concern or any more details are required. But would request all GATE expert people to help me a bit. – abhijit nag Apr 04 '13 at 04:19

1 Answers1

0

Finally I have resolved this problem. I have added following AnnotationSet with gate.learning.LearningAPIMain instance.

learner.setInputASName("Key"); learner.setOutputASName("Key");

Now my saved files are generating with proper format.

abhijit nag
  • 451
  • 6
  • 24