@Test public void testNaiveBayes2() throws IOException { testDataIndexer.index(createTrainingStream()); NaiveBayesModel model = (NaiveBayesModel) new NaiveBayesTrainer().trainModel(testDataIndexer); String label = "sports"; String[] context = {"bow=manchester", "bow=united"}; Event event = new Event(label, context); // testModel(model, event, 1.0); // Expected value without smoothing testModel(model, event, 0.9658833555831029); // Expected value with smoothing }
@Test public void testNaiveBayes1() throws IOException { testDataIndexer.index(createTrainingStream()); NaiveBayesModel model = (NaiveBayesModel) new NaiveBayesTrainer().trainModel(testDataIndexer); String label = "politics"; String[] context = {"bow=united", "bow=nations"}; Event event = new Event(label, context); // testModel(model, event, 1.0); // Expected value without smoothing testModel(model, event, 0.9681650180264167); // Expected value with smoothing }
@Test public void testNaiveBayes3() throws IOException { testDataIndexer.index(createTrainingStream()); NaiveBayesModel model = (NaiveBayesModel) new NaiveBayesTrainer().trainModel(testDataIndexer); String label = "politics"; String[] context = {"bow=united"}; Event event = new Event(label, context); //testModel(model, event, 2.0/3.0); // Expected value without smoothing testModel(model, event, 0.6655036407766989); // Expected value with smoothing }
@Test public void testNaiveBayes4() throws IOException { testDataIndexer.index(createTrainingStream()); NaiveBayesModel model = (NaiveBayesModel) new NaiveBayesTrainer().trainModel(testDataIndexer); String label = "politics"; String[] context = {}; Event event = new Event(label, context); testModel(model, event, 7.0 / 12.0); }