mergeWith() public méthode

public mergeWith ( DecisionList dlist2 ) : DecisionList
dlist2 DecisionList
Résultat DecisionList
        public void testDecisionListMerge()
        {
            DecisionList dlist1 = new DecisionList("Yes", "No");
            DecisionList dlist2 = new DecisionList("Yes", "No");
            DataSet ds = DataSetFactory.getRestaurantDataSet();

            DLTest test1 = new DLTest();
            test1.add("type", "Thai"); // doesn't match first example
            dlist1.add(test1, "test1success");

            DLTest test2 = new DLTest();
            test2.add("type", "French");
            dlist2.add(test2, "test2success");// matches first example

            DecisionList dlist3 = dlist1.mergeWith(dlist2);
            Assert.AreEqual("test2success", dlist3.predict(ds.getExample(0)));
        }
 //
 // PRIVATE METHODS
 //
 private DecisionList decisionListLearning(DataSet ds)
 {
     if (ds.size() == 0)
     {
         return new DecisionList(positive, negative);
     }
     List<DLTest> possibleTests = testFactory
             .createDLTestsWithAttributeCount(ds, 1);
     DLTest test = getValidTest(possibleTests, ds);
     if (test == null)
     {
         return new DecisionList(null, FAILURE);
     }
     // at this point there is a test that classifies some subset of examples
     // with the same target value
     DataSet matched = test.matchedExamples(ds);
     DecisionList list = new DecisionList(positive, negative);
     list.add(test, matched.getExample(0).targetValue());
     return list.mergeWith(decisionListLearning(test.unmatchedExamples(ds)));
 }