Java GATE ML信息提取过程无法生成适当的类级别
我正在努力学习机器学习。在提取信息的情况下,保存文件将正确填充数据。但是NLPFeaturesData中的类级别数为0。保存文件和日志听起来也像 93#numTrainingDocsJava GATE ML信息提取过程无法生成适当的类级别,java,nlp,bigdata,gate,Java,Nlp,Bigdata,Gate,我正在努力学习机器学习。在提取信息的情况下,保存文件将正确填充数据。但是NLPFeaturesData中的类级别数为0。保存文件和日志听起来也像 93#numTrainingDocs 0#numclass 53738#Numnullabelistance 9006940#全部功能 C:\…\learnedModels.save#modelFile SVMLibSvmJava#learnerName 空#learnerExecutable -c0.7-t0-m100-tau 0.4#learner
0#numclass
53738#Numnullabelistance
9006940#全部功能
C:\…\learnedModels.save#modelFile
SVMLibSvmJava#learnerName
空#learnerExecutable
-c0.7-t0-m100-tau 0.4#learnerParams 我已经运行了以下代码库。但生成的“NLPFeatureData.save”文件的所有类级别为0。有人能帮我一下机器学习中哪里出了问题吗
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);
}
}
试试看{
//******************加载门及其插件[加载学习]***********************************
System.setProperty(“gate.home”、“C:\\Program Files\\gate\u Developer\u 7.1”);
Gate.init();
Gate.getCreoleRegister().registerDirectories(新文件(Gate.getPluginsHome(),ANNIEConstants.PLUGIN_DIR.toURI().tour());
getCreoleRegister().registerDirectories(新URL(文件\工作\路径+“/plugins/Learning”);
//*******************实例化语料库并加载培训文档******************************************************
gate.Corpus语料库=(Corpus)Factory.createResource(“gate.corpora.CorpusImpl”);
FileFilter FileFilter=newfilefilter(){
公共布尔接受(文件路径名){
//TODO自动生成的方法存根
返回true;
}
};
填充(新URL(“…/corpus”),文件过滤器,“UTF-8”,false);
Gate.getCreoleRegister().registerDirectories();
//制作一个管道并添加语料库
FeatureMap pfm=Factory.newFeatureMap();
pfm.put(“语料库”,语料库);
管道=(gate.creole.serialAnalyzerController)gate.Factory.createResource(“gate.creole.serialAnalyzerController”,pfm);
initAnnie();
//*********************************使用关系配置文件和学习api进行配置
File configFile=new File(“../learning config.xml”);//无论它在哪里
RunMode=RunMode.TRAINING;//或培训,或应用程序。。
FeatureMap fm=Factory.newFeatureMap();
put(“configFileURL”,configFile.toURI().toURL());
fm.put(“学习模式”,模式);
gate.learning.learningapiman学习者=(gate.learning.learningapiman)gate.Factory.createResource(“gate.learning.learningapiman”,fm);
管道。添加(学习者);
pipeline.execute();
}捕获(例外e){
e、 printStackTrace();
}
}
私有静态void initAnnie()引发GateException{
对于(int i=0;i
我终于解决了这个问题。我添加了以下带有gate.learning.LearningAPIMain的注释集
learner.setInputASName(“键”);
learner.setOutputASName(“键”)
现在,我保存的文件正在以正确的格式生成。我的问题清楚了吗。如果需要任何问题或更多细节,请告诉我。但我会要求所有的专家帮我一点忙。