learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(branch+"_states"+states+"_sample"+sample);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for the behaviour of different learners", numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
for(Entry<String,ScoresForGraph> score:sample.miscGraphs.entrySet())
gr_StructuralForDifferentLearners.add(score.getKey(),score.getValue().differenceStructural.getValue());
for(SampleData sample:result.samples)
for(Entry<String,ScoresForGraph> score:sample.miscGraphs.entrySet())
gr_BCRForDifferentLearners.add(score.getKey(),score.getValue().differenceBCR.getValue());
progress.next();
gr_BCRForDifferentLearners.drawInteractive(gr);gr_StructuralForDifferentLearners.drawInteractive(gr);
}
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
}
if (gr_BCRForDifferentLearners != null) gr_BCRForDifferentLearners.drawPdf(gr);if (gr_StructuralForDifferentLearners != null) gr_StructuralForDifferentLearners.drawPdf(gr);
/*
for(final boolean useCentreVertex:new boolean[]{true,false})
for(final boolean useDifferentScoringNearRoot:new boolean[]{true,false})
for(final boolean mergeIdentifiedPathsAfterInference:new boolean[]{true,false})
for(final boolean useClassifyToOrderPairs:new boolean[]{true,false})
for(final int traceQuantity:new int[]{10})
for(final double traceLengthMultiplier:new double[]{1})
{
final int traceQuantityToUse = traceQuantity;
String selection = "c="+useCentreVertex+
";r="+useDifferentScoringNearRoot+
";m="+mergeIdentifiedPathsAfterInference+
";o="+useClassifyToOrderPairs+
";traceQuantity="+traceQuantity+";traceLengthMultiplier="+traceLengthMultiplier+";"+";alphabetMultiplier="+alphabetMultiplier+";";
SquareBagPlot gr_StructuralDiff = new SquareBagPlot("Structural score, Sicco","Structural Score, EDSM-Markov learner",new File(branch+"_"+selection+"_trace_structuraldiff.pdf"),0,1,true);
SquareBagPlot gr_BCR = new SquareBagPlot("BCR, Sicco","BCR, EDSM-Markov learner",new File(branch+"_"+selection+"_trace_bcr.pdf"),0.5,1,true);
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceQuantityToUse, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setAlphabetMultiplier(alphabetMultiplier);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplier);
learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection);
learnerRunner.setlearningParameters(useCentreVertex, useDifferentScoringNearRoot, mergeIdentifiedPathsAfterInference, useClassifyToOrderPairs);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for learning whole graphs", numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
gr_StructuralDiff.add(sample.referenceLearner.differenceStructural.getValue(),sample.actualLearner.differenceStructural.getValue());
for(SampleData sample:result.samples)
{
gr_BCR.add(sample.referenceLearner.differenceBCR.getValue(),sample.actualLearner.differenceBCR.getValue());
}
progress.next();
}
gr_StructuralDiff.drawInteractive(gr);
gr_BCR.drawInteractive(gr);
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
if (gr_StructuralDiff != null) gr_StructuralDiff.drawPdf(gr);
if (gr_BCR != null) gr_BCR.drawPdf(gr);
}
*/
for(final int preset: new int[]{0,4})//0,1,2})
{
final int traceQuantityToUse = traceQuantity;
long comparisonsPerformed = 0;
String selection = "preset="+preset+";quantity="+traceQuantity+";tracelen="+traceLengthMultiplierMax+";statesMax="+(minStateNumber+rangeOfStateNumbers-stateNumberIncrement)+";alphabetMult="+alphabetMultiplierMax+";";
SquareBagPlot gr_StructuralDiff = new SquareBagPlot("Structural score, Sicco","Structural Score, EDSM-Markov learner",new File(branch+"_"+preset+"_"+(minStateNumber+rangeOfStateNumbers-stateNumberIncrement)+"_trace_structuraldiff.pdf"),0,1,true);
SquareBagPlot gr_BCR = new SquareBagPlot("BCR, Sicco","BCR, EDSM-Markov learner",new File(branch+"_"+preset+"_"+(minStateNumber+rangeOfStateNumbers-stateNumberIncrement)+"_trace_bcr.pdf"),0.5,1,true);
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceQuantityToUse, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTracesAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);
learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection);
learnerRunner.setPresetLearningParameters(preset);
learnerRunner.setDisableInconsistenciesInMergers(false);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for learning whole graphs", numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
gr_StructuralDiff.add(sample.referenceLearner.differenceStructural.getValue(),sample.actualLearner.differenceStructural.getValue());
for(SampleData sample:result.samples)
{
gr_BCR.add(sample.referenceLearner.differenceBCR.getValue(),sample.actualLearner.differenceBCR.getValue());
comparisonsPerformed+=sample.comparisonsPerformed;
}
if (count % 10 == 0)
{
gr_StructuralDiff.drawInteractive(gr);
gr_BCR.drawInteractive(gr);
}
progress.next();
}
gr_StructuralDiff.drawInteractive(gr);
gr_BCR.drawInteractive(gr);
System.out.println("\nLOG of comparisons performed: "+Math.log10(comparisonsPerformed)+"\n");
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
if (gr_StructuralDiff != null) gr_StructuralDiff.drawPdf(gr);
if (gr_BCR != null) gr_BCR.drawPdf(gr);
}
final int presetForBestResults = 0;
final int traceQuantityToUse = traceQuantity;
{
SquareBagPlot gr_StructuralDiffWithoutInconsistencies = new SquareBagPlot("Structural score, Sicco","Structural Score, EDSM-Markov learner",new File(branch+"_noinconsistencies_trace_structuraldiff.pdf"),0,1,true);
SquareBagPlot gr_BCRWithoutInconsistencies = new SquareBagPlot("BCR, Sicco","BCR, EDSM-Markov learner",new File(branch+"_noinconsistencies_trace_bcr.pdf"),0.5,1,true);
String selection = "noinconsistencies;quantity="+traceQuantity+";tracelen="+traceLengthMultiplierMax+";alphabetMult="+alphabetMultiplierMax+";";
long comparisonsPerformed = 0;
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceQuantityToUse, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);
learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection);
learnerRunner.setPresetLearningParameters(presetForBestResults);
learnerRunner.setDisableInconsistenciesInMergers(true);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for learning without inconsistencies", numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
gr_StructuralDiffWithoutInconsistencies.add(sample.referenceLearner.differenceStructural.getValue(),sample.actualLearner.differenceStructural.getValue());
for(SampleData sample:result.samples)
{
gr_BCRWithoutInconsistencies.add(sample.referenceLearner.differenceBCR.getValue(),sample.actualLearner.differenceBCR.getValue());
comparisonsPerformed+=sample.comparisonsPerformed;
}
if (count % 10 == 0)
{
gr_StructuralDiffWithoutInconsistencies.drawInteractive(gr);
gr_BCRWithoutInconsistencies.drawInteractive(gr);
}
progress.next();
}
gr_StructuralDiffWithoutInconsistencies.drawInteractive(gr);
gr_BCRWithoutInconsistencies.drawInteractive(gr);
System.out.println("\nLOG of comparisons performed: "+Math.log10(comparisonsPerformed)+"\n");
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
if (gr_StructuralDiffWithoutInconsistencies != null) gr_StructuralDiffWithoutInconsistencies.drawPdf(gr);
if (gr_BCRWithoutInconsistencies != null) gr_BCRWithoutInconsistencies.drawPdf(gr);
}
// Same experiment but with different number of sequences.
final RBoxPlot<Integer> gr_BCRImprovementForDifferentNrOfTracesWithNegatives = new RBoxPlot<Integer>("nr of traces","improvement, BCR",new File(branch+"WithNegatives_BCR_vs_tracenumber.pdf"));
final RBoxPlot<Integer> gr_BCRForDifferentNrOfTracesWithNegatives = new RBoxPlot<Integer>("nr of traces","BCR",new File(branch+"WithNegatives_BCR_absolute_vs_tracenumber.pdf"));
final RBoxPlot<Integer> gr_StructuralImprovementForDifferentNrOfTracesWithNegatives = new RBoxPlot<Integer>("nr of traces","improvement, structural",new File(branch+"WithNegatives_structural_vs_tracenumber.pdf"));
final RBoxPlot<Integer> gr_StructuralForDifferentNrOfTracesWithNegatives = new RBoxPlot<Integer>("nr of traces","structural",new File(branch+"WithNegatives_structural_absolute_vs_tracenumber.pdf"));
for(final int traceNum:new int[]{2,4,6,8,10})
{
String selection = "number_of_traces="+traceNum;
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceNum, config, converter);
learnerRunner.setOnlyUsePositives(false);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);
learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection);
learnerRunner.setPresetLearningParameters(presetForBestResults);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection+" trace num: "+traceNum, numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
{
if (sample.referenceLearner.differenceBCR.getValue() > 0)
{
// we'll generate both positives and negatives; in the considered experiments, only positives are used hence half the number of sequences are actually being learnt from.
gr_BCRImprovementForDifferentNrOfTracesWithNegatives.add(traceNum,sample.actualLearner.differenceBCR.getValue()/sample.referenceLearner.differenceBCR.getValue());
gr_BCRForDifferentNrOfTracesWithNegatives.add(traceNum,sample.actualLearner.differenceBCR.getValue());
}
if (sample.referenceLearner.differenceStructural.getValue() > 0)
{
gr_StructuralImprovementForDifferentNrOfTracesWithNegatives.add(traceNum,sample.actualLearner.differenceStructural.getValue()/sample.referenceLearner.differenceStructural.getValue());
gr_StructuralForDifferentNrOfTracesWithNegatives.add(traceNum,sample.actualLearner.differenceStructural.getValue());
}
}
progress.next();
}
gr_BCRForDifferentNrOfTracesWithNegatives.drawInteractive(gr);gr_StructuralForDifferentNrOfTracesWithNegatives.drawInteractive(gr);
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
}
if (gr_BCRImprovementForDifferentNrOfTracesWithNegatives != null) gr_BCRImprovementForDifferentNrOfTracesWithNegatives.drawPdf(gr);
if (gr_BCRForDifferentNrOfTracesWithNegatives != null) gr_BCRForDifferentNrOfTracesWithNegatives.drawPdf(gr);
if (gr_StructuralImprovementForDifferentNrOfTracesWithNegatives != null) gr_StructuralImprovementForDifferentNrOfTracesWithNegatives.drawPdf(gr);
if (gr_StructuralForDifferentNrOfTracesWithNegatives != null) gr_StructuralForDifferentNrOfTracesWithNegatives.drawPdf(gr);
// Same experiment but with different number of sequences.
final RBoxPlot<Integer> gr_BCRImprovementForDifferentNrOfTraces = new RBoxPlot<Integer>("nr of traces","improvement, BCR",new File(branch+"BCR_vs_tracenumber.pdf"));
final RBoxPlot<Integer> gr_BCRForDifferentNrOfTraces = new RBoxPlot<Integer>("nr of traces","BCR",new File(branch+"BCR_absolute_vs_tracenumber.pdf"));
final RBoxPlot<Integer> gr_StructuralImprovementForDifferentNrOfTraces = new RBoxPlot<Integer>("nr of traces","improvement, structural",new File(branch+"structural_vs_tracenumber.pdf"));
final RBoxPlot<Integer> gr_StructuralForDifferentNrOfTraces = new RBoxPlot<Integer>("nr of traces","structural",new File(branch+"structural_absolute_vs_tracenumber.pdf"));
for(final int traceNum:new int[]{2,4,6,8,10})
{
String selection = "number_of_traces="+traceNum;
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceNum, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);
learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection);
learnerRunner.setPresetLearningParameters(presetForBestResults);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection+" trace num: "+traceNum, numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
{
if (sample.referenceLearner.differenceBCR.getValue() > 0)
{
// we'll generate both positives and negatives; in the considered experiments, only positives are used hence half the number of sequences are actually being learnt from.
gr_BCRImprovementForDifferentNrOfTraces.add(traceNum/2,sample.actualLearner.differenceBCR.getValue()/sample.referenceLearner.differenceBCR.getValue());
gr_BCRForDifferentNrOfTraces.add(traceNum/2,sample.actualLearner.differenceBCR.getValue());
}
if (sample.referenceLearner.differenceStructural.getValue() > 0)
{
gr_StructuralImprovementForDifferentNrOfTraces.add(traceNum/2,sample.actualLearner.differenceStructural.getValue()/sample.referenceLearner.differenceStructural.getValue());
gr_StructuralForDifferentNrOfTraces.add(traceNum/2,sample.actualLearner.differenceStructural.getValue());
}
}
progress.next();
}
gr_BCRForDifferentNrOfTraces.drawInteractive(gr);gr_StructuralForDifferentNrOfTraces.drawInteractive(gr);
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
}
if (gr_BCRImprovementForDifferentNrOfTraces != null) gr_BCRImprovementForDifferentNrOfTraces.drawPdf(gr);
if (gr_BCRForDifferentNrOfTraces != null) gr_BCRForDifferentNrOfTraces.drawPdf(gr);
if (gr_StructuralImprovementForDifferentNrOfTraces != null) gr_StructuralImprovementForDifferentNrOfTraces.drawPdf(gr);
if (gr_StructuralForDifferentNrOfTraces != null) gr_StructuralForDifferentNrOfTraces.drawPdf(gr);
// Same experiment but with different trace length but the same number of sequences
final RBoxPlot<Double> gr_BCRImprovementForDifferentLengthOfTraces = new RBoxPlot<Double>("trace length multiplier","improvement, BCR",new File(branch+"BCR_vs_tracelength.pdf"));
final RBoxPlot<Double> gr_BCRForDifferentLengthOfTraces = new RBoxPlot<Double>("trace length multiplier","BCR",new File(branch+"BCR_absolute_vs_tracelength.pdf"));
final RBoxPlot<Double> gr_StructuralImprovementForDifferentLengthOfTraces = new RBoxPlot<Double>("trace length multiplier","improvement, structural",new File(branch+"structural_vs_tracelength.pdf"));
final RBoxPlot<Double> gr_StructuralForDifferentLengthOfTraces = new RBoxPlot<Double>("trace length multiplier","structural",new File(branch+"structural_absolute_vs_tracelength.pdf"));
final RBoxPlot<Double> gr_TransitionCoverageForDifferentLengthOfTraces = new RBoxPlot<Double>("trace length multiplier","transition coverage",new File(branch+"transitionCoverage_vs_tracelength.pdf"));
for(final int traceNum:new int[]{10})
for(double traceLengthMultiplierToUse=0.125;traceLengthMultiplierToUse<4;traceLengthMultiplierToUse*=2.)
{
String selection="traceLengthMultiplier="+traceLengthMultiplierToUse;
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceNum, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierToUse);
learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection);
learnerRunner.setPresetLearningParameters(presetForBestResults);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection+" trace length multiplier "+traceLengthMultiplierToUse, numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
{
if (sample.referenceLearner.differenceBCR.getValue() > 0)
{
gr_BCRImprovementForDifferentLengthOfTraces.add(traceLengthMultiplierToUse,sample.actualLearner.differenceBCR.getValue()/sample.referenceLearner.differenceBCR.getValue());
gr_BCRForDifferentLengthOfTraces.add(traceLengthMultiplierToUse,sample.actualLearner.differenceBCR.getValue());
}
if (sample.referenceLearner.differenceStructural.getValue() > 0)
{
gr_StructuralImprovementForDifferentLengthOfTraces.add(traceLengthMultiplierToUse,sample.actualLearner.differenceStructural.getValue()/sample.referenceLearner.differenceStructural.getValue());
gr_StructuralForDifferentLengthOfTraces.add(traceLengthMultiplierToUse,sample.actualLearner.differenceStructural.getValue());
}
gr_TransitionCoverageForDifferentLengthOfTraces.add(traceLengthMultiplierToUse,(double)sample.transitionsSampled);
}
progress.next();
}
gr_BCRForDifferentLengthOfTraces.drawInteractive(gr);gr_StructuralForDifferentLengthOfTraces.drawInteractive(gr);gr_TransitionCoverageForDifferentLengthOfTraces.drawInteractive(gr);
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
}
if (gr_BCRImprovementForDifferentLengthOfTraces != null) gr_BCRImprovementForDifferentLengthOfTraces.drawPdf(gr);
if (gr_BCRForDifferentLengthOfTraces != null) gr_BCRForDifferentLengthOfTraces.drawPdf(gr);
if (gr_StructuralImprovementForDifferentLengthOfTraces != null) gr_StructuralImprovementForDifferentLengthOfTraces.drawPdf(gr);
if (gr_StructuralForDifferentLengthOfTraces != null) gr_StructuralForDifferentLengthOfTraces.drawPdf(gr);
if (gr_TransitionCoverageForDifferentLengthOfTraces != null) gr_TransitionCoverageForDifferentLengthOfTraces.drawPdf(gr);
final RBoxPlot<Integer> gr_BCRImprovementForDifferentPrefixlen = new RBoxPlot<Integer>("length of prefix","improvement, BCR",new File(branch+"BCR_vs_prefixLength.pdf"));
final RBoxPlot<Integer> gr_BCRForDifferentPrefixlen = new RBoxPlot<Integer>("length of prefix","BCR",new File(branch+"BCR_absolute_vs_prefixLength.pdf"));
final RBoxPlot<Integer> gr_StructuralImprovementForDifferentPrefixlen = new RBoxPlot<Integer>("length of prefix","improvement, structural",new File(branch+"structural_vs_prefixLength.pdf"));
final RBoxPlot<Integer> gr_StructuralForDifferentPrefixlen = new RBoxPlot<Integer>("length of prefix","structural",new File(branch+"structural_absolute_vs_prefixLength.pdf"));
final RBoxPlot<String> gr_MarkovAccuracyForDifferentPrefixlen = new RBoxPlot<String>("length of prefix","Markov accuracy",new File(branch+"markov_accuracy_vs_prefixLength.pdf"));
for(int prefixLength=1;prefixLength<3;++prefixLength)
{
String selection="prefix Length ="+prefixLength;
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceQuantity, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);
learnerRunner.setChunkLen(prefixLength+1);
learnerRunner.setSelectionID(selection);
learnerRunner.setPresetLearningParameters(presetForBestResults);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection+" using prefix length "+prefixLength, numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
{
if (sample.referenceLearner.differenceBCR.getValue() > 0)
{
gr_BCRImprovementForDifferentPrefixlen.add(prefixLength,sample.actualLearner.differenceBCR.getValue()/sample.referenceLearner.differenceBCR.getValue());
gr_BCRForDifferentPrefixlen.add(prefixLength,sample.actualLearner.differenceBCR.getValue());
}
if (sample.referenceLearner.differenceStructural.getValue() > 0)
{
gr_StructuralImprovementForDifferentPrefixlen.add(prefixLength,sample.actualLearner.differenceStructural.getValue()/sample.referenceLearner.differenceStructural.getValue());
gr_StructuralForDifferentPrefixlen.add(prefixLength,sample.actualLearner.differenceStructural.getValue());
}
gr_MarkovAccuracyForDifferentPrefixlen.add(""+prefixLength+",P",(double)sample.markovPrecision,"green");
gr_MarkovAccuracyForDifferentPrefixlen.add(""+prefixLength+",R",(double)sample.markovRecall,"blue");
}
progress.next();
}
gr_BCRForDifferentPrefixlen.drawInteractive(gr);gr_StructuralForDifferentPrefixlen.drawInteractive(gr);gr_MarkovAccuracyForDifferentPrefixlen.drawInteractive(gr);
}
catch(Exception ex)
{
IllegalArgumentException e = new IllegalArgumentException("failed to compute, the problem is: "+ex);e.initCause(ex);
if (executorService != null) { executorService.shutdownNow();executorService = null; }
throw e;
}
}
if (gr_BCRImprovementForDifferentPrefixlen != null) gr_BCRImprovementForDifferentPrefixlen.drawPdf(gr);
if (gr_BCRForDifferentPrefixlen != null) gr_BCRForDifferentPrefixlen.drawPdf(gr);
if (gr_StructuralImprovementForDifferentPrefixlen != null) gr_StructuralImprovementForDifferentPrefixlen.drawPdf(gr);
if (gr_StructuralForDifferentPrefixlen != null) gr_StructuralForDifferentPrefixlen.drawPdf(gr);
if (gr_MarkovAccuracyForDifferentPrefixlen != null) gr_MarkovAccuracyForDifferentPrefixlen.drawPdf(gr);
final RBoxPlot<String> gr_BCRImprovementForDifferentAlphabetSize = new RBoxPlot<String>("alphabet multiplier","improvement, BCR",new File(branch+"BCR_vs_alphabet.pdf"));
final RBoxPlot<String> gr_BCRForDifferentAlphabetSize = new RBoxPlot<String>("alphabet multiplier","BCR",new File(branch+"BCR_absolute_vs_alphabet.pdf"));
final RBoxPlot<String> gr_StructuralImprovementForDifferentAlphabetSize = new RBoxPlot<String>("alphabet multiplier","improvement, structural",new File(branch+"structural_vs_alphabet.pdf"));
final RBoxPlot<String> gr_StructuralForDifferentAlphabetSize = new RBoxPlot<String>("alphabet multiplier","structural",new File(branch+"structural_absolute_vs_alphabet.pdf"));
final RBoxPlot<String> gr_MarkovAccuracyForDifferentAlphabetSize = new RBoxPlot<String>("alphabet multiplier","Markov accuracy",new File(branch+"markov_accuracy_vs_alphabet.pdf"));
// Same experiment but with different alphabet size
for(final double alphabetMultiplierActual:new double[]{alphabetMultiplierMax/4,alphabetMultiplierMax/2,alphabetMultiplierMax,alphabetMultiplierMax*2,alphabetMultiplierMax*4})
{
String selection="alphabet_size="+alphabetMultiplierActual;
try
{
int numberOfTasks = 0;
for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
for(int sample=0;sample<samplesPerFSM;++sample)
{
LearnerRunner learnerRunner = new LearnerRunner(states,sample,numberOfTasks,traceQuantity, config, converter);
learnerRunner.setOnlyUsePositives(onlyPositives);
learnerRunner.setTracesAlphabetMultiplier(alphabetMultiplierMax);
learnerRunner.setAlphabetMultiplier(alphabetMultiplierActual);
learnerRunner.setTraceLengthMultiplier(traceLengthMultiplierMax);learnerRunner.setChunkLen(chunkSize);
learnerRunner.setSelectionID(selection+"_states"+states+"_sample"+sample);
learnerRunner.setPresetLearningParameters(presetForBestResults);
runner.submit(learnerRunner);
++numberOfTasks;
}
ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection+" alphabet multiplier: "+alphabetMultiplierActual, numberOfTasks);
for(int count=0;count < numberOfTasks;++count)
{
ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
for(SampleData sample:result.samples)
{
if (sample.referenceLearner.differenceBCR.getValue() > 0)
{
gr_BCRImprovementForDifferentAlphabetSize.add(String.format("%.2f",alphabetMultiplierActual),sample.actualLearner.differenceBCR.getValue()/sample.referenceLearner.differenceBCR.getValue());
gr_BCRForDifferentAlphabetSize.add(String.format("%.2f",alphabetMultiplierActual),sample.actualLearner.differenceBCR.getValue());
}
if (sample.referenceLearner.differenceStructural.getValue() > 0)
{
gr_StructuralImprovementForDifferentAlphabetSize.add(String.format("%.2f",alphabetMultiplierActual),sample.actualLearner.differenceStructural.getValue()/sample.referenceLearner.differenceStructural.getValue());
gr_StructuralForDifferentAlphabetSize.add(String.format("%.2f",alphabetMultiplierActual),sample.actualLearner.differenceStructural.getValue());
}
gr_MarkovAccuracyForDifferentAlphabetSize.add(String.format("%.2f,P",alphabetMultiplierActual),(double)sample.markovPrecision,"green");
gr_MarkovAccuracyForDifferentAlphabetSize.add(String.format("%.2f,R",alphabetMultiplierActual),(double)sample.markovRecall,"blue");
}
progress.next();
}
gr_BCRImprovementForDifferentAlphabetSize.drawInteractive(gr);gr_BCRForDifferentAlphabetSize.drawInteractive(gr);gr_MarkovAccuracyForDifferentAlphabetSize.drawInteractive(gr);
gr_StructuralImprovementForDifferentAlphabetSize.drawInteractive(gr);gr_StructuralForDifferentAlphabetSize.drawInteractive(gr);
}
catch(Exception ex)