現在、クラシファイアのモデルをトレーニングしています。昨日、作成した分類モデルをテストすると、より正確になることがわかりました。モデルをテストする方法をインターネットで検索しました:testing openNLP model。しかし、私はそれを働かせることはできません。なぜなら私は1.5の代わりにOpenNLPバージョン1.83を使っているからです。誰でも私のモデルをOpenNLPのこのバージョンで適切にテストする方法を教えてもらえますか?OpenNLPクラシファイアモデルをテストする
ありがとうございます。
public static DoccatModel trainClassifier() throws IOException
{
// read the training data
final int iterations = 100;
InputStreamFactory dataIn = new MarkableFileInputStreamFactory(new File("src/main/resources/trainingSets/trainingssetTest.txt"));
ObjectStream<String> lineStream = new PlainTextByLineStream(dataIn, "UTF-8");
ObjectStream<DocumentSample> sampleStream = new DocumentSampleStream(lineStream);
// define the training parameters
TrainingParameters params = new TrainingParameters();
params.put(TrainingParameters.ITERATIONS_PARAM, iterations+"");
params.put(TrainingParameters.CUTOFF_PARAM, 0+"");
params.put(AbstractTrainer.ALGORITHM_PARAM, NaiveBayesTrainer.NAIVE_BAYES_VALUE);
// create a model from traning data
DoccatModel model = DocumentCategorizerME.train("NL", sampleStream, params, new DoccatFactory());
return model;
}