/** Each test starts with this configuration. */
private Configuration mainConfiguration = null;
protected void checkLearner(String fsmString, String [][] plus, String [][] minus)
{
final DirectedSparseGraph g = TestFSMAlgo.buildGraph(fsmString, "sample FSM");
final LearnerGraph expected = new LearnerGraph(g,testConfig);
// now sanity checking on the plus and minus sets
for(String [] path:plus)
assert RPNIBlueFringeLearner.USER_ACCEPTED == expected.paths.tracePath(Arrays.asList(path));
for(String [] path:minus)
assert RPNIBlueFringeLearner.USER_ACCEPTED != expected.paths.tracePath(Arrays.asList(path));
// Visualiser.getVisualiser()
RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,testConfig)
{
@Override
protected Pair<Integer,String> checkWithEndUser(
@SuppressWarnings("unused") LearnerGraph model,
List<String> question,
@SuppressWarnings("unused") final Object [] moreOptions)
{
return new Pair<Integer,String>(expected.paths.tracePath(question),null);
}
};
config.setDebugMode(false);
//l.setPairsMergedPerHypothesis(0);
//l.setGeneralisationThreshold(1);
//l.setCertaintyThreshold(5);
testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
l.init(buildSet(plus), buildSet(minus));
DirectedSparseGraph learningOutcomeA = l.learnMachine();
LearnerGraph learntStructureA = new LearnerGraph(learningOutcomeA,testConfig);
// Now do the same with ptasets instead of real sets
PTASequenceSet plusPTA = new PTASequenceSet();plusPTA.addAll(buildSet(plus));PTASequenceSet minusPTA = new PTASequenceSet();minusPTA.addAll(buildSet(minus));
l.init(plusPTA, minusPTA);
DirectedSparseGraph learningOutcomeB = l.learnMachine();
LearnerGraph learntStructureB = new LearnerGraph(learningOutcomeB,testConfig);
WMethod.checkM(learntStructureA, learntStructureB);
//TestFSMAlgo.checkM(learntStructure,completedGraph,learntStructure.init,expected.init);
}