Examples of SquareBagPlot


Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

                ";selectingRed="+selectingRed+";classifierToBlockAllMergers="+classifierToBlockAllMergers+";zeroScoringAsRed="+zeroScoringAsRed+";traceQuantity="+traceQuantity+";lengthMultiplier="+lengthMultiplier+";trainingDataMultiplier="+trainingDataMultiplier+";";

            final int totalTaskNumber = traceQuantity;
            final RBoxPlot<Long> gr_PairQuality = new RBoxPlot<Long>("Correct v.s. wrong","%%",new File("percentage_score"+selection+".pdf"));
            final RBoxPlot<String> gr_QualityForNumberOfTraces = new RBoxPlot<String>("traces","%%",new File("quality_traces"+selection+".pdf"));
            SquareBagPlot gr_NewToOrig = new SquareBagPlot("orig score","score with learnt selection",new File("new_to_orig"+selection+".pdf"),0,1,true);
            final Map<Long,TrueFalseCounter> pairQualityCounter = new TreeMap<Long,TrueFalseCounter>();
            try
            {
              int numberOfTasks = 0;
              for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
                for(int sample=0;sample<samplesPerFSM;++sample)
                {
                  LearnerRunner learnerRunner = new LearnerRunner(dataCollector,states,sample,totalTaskNumber+numberOfTasks,traceQuantity, config, converter)
                  {
                    @Override
                    public LearnerThatCanClassifyPairs createLearner(LearnerEvaluationConfiguration evalCnf,LearnerGraph argReferenceGraph,@SuppressWarnings("unused") WekaDataCollector argDataCollector,  LearnerGraph argInitialPTA)
                    {
                      LearnerThatUsesWekaResults l = new LearnerThatUsesWekaResults(ifDepth,evalCnf,argReferenceGraph,classifier,argInitialPTA);
                      if (gr_PairQuality != null)
                        l.setPairQualityCounter(pairQualityCounter);
                     
                      l.setUseClassifierForRed(selectingRed);l.setUseClassifierToChooseNextRed(classifierToBlockAllMergers);
                      l.setBlacklistZeroScoringPairs(zeroScoringAsRed);
                      l.setThreshold(threshold);
                      return l;
                    }
                   
                  };
                  learnerRunner.setPickUniqueFromInitial(useUnique);learnerRunner.setEvaluateAlsoUsingReferenceLearner(true);
                  learnerRunner.setOnlyUsePositives(onlyPositives);learnerRunner.setIfdepth(ifDepth);learnerRunner.setLengthMultiplier(lengthMultiplier);
                  learnerRunner.setSelectionID(selection+"_states"+states+"_sample"+sample);
                  runner.submit(learnerRunner);
                  ++numberOfTasks;
                }
              ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection, numberOfTasks);
              for(int count=0;count < numberOfTasks;++count)
              {
                ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
                if (gr_NewToOrig != null)
                {
                  for(SampleData sample:result.samples)
                    gr_NewToOrig.add(sample.differenceForReferenceLearner.getValue(),sample.difference.getValue());
                }
               
                for(SampleData sample:result.samples)
                  if (sample.differenceForReferenceLearner.getValue() > 0)
                    gr_QualityForNumberOfTraces.add(traceQuantity+"",sample.difference.getValue()/sample.differenceForReferenceLearner.getValue());
                progress.next();
              }
              if (gr_PairQuality != null)
              {
                synchronized(pairQualityCounter)
                {
                  updateGraph(gr_PairQuality,pairQualityCounter);
                  //gr_PairQuality.drawInteractive(gr);
                  //gr_NewToOrig.drawInteractive(gr);
                  //if (gr_QualityForNumberOfTraces.size() > 0)
                  //  gr_QualityForNumberOfTraces.drawInteractive(gr);
                }
              }
              if (gr_PairQuality != null) gr_PairQuality.drawPdf(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_NewToOrig != null) gr_NewToOrig.drawPdf(gr);
            if (gr_QualityForNumberOfTraces != null) gr_QualityForNumberOfTraces.drawPdf(gr);
          }
        }
      }
    if (executorService != null) { executorService.shutdown();executorService = null; }
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

    {
       
      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"));
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

                ";onlyPositives="+onlyPositives+";selectingRed="+selectingRed+";classifierToBlockAllMergers="+classifierToBlockAllMergers+";zeroScoringAsRed="+zeroScoringAsRed+";lengthMultiplier="+lengthMultiplier+";";

            final int totalTaskNumber = traceQuantity;
            final RBoxPlot<Long> gr_PairQuality = new RBoxPlot<Long>("Correct v.s. wrong","%%",new File("percentage_score"+selection.substring(0, 80)+".pdf"));
            final RBoxPlot<String> gr_QualityForNumberOfTraces = new RBoxPlot<String>("traces","%%",new File("quality_traces"+selection.substring(0, 80)+".pdf"));
            SquareBagPlot gr_NewToOrig = new SquareBagPlot("orig score","score with learnt selection",new File("new_to_orig"+selection.substring(0, 80)+".pdf"),0,1,true);
            final Map<Long,TrueFalseCounter> pairQualityCounter = new TreeMap<Long,TrueFalseCounter>();
            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,totalTaskNumber+numberOfTasks,traceQuantity, config, converter);
                  learnerRunner.setPickUniqueFromInitial(useUnique);
                  learnerRunner.setOnlyUsePositives(onlyPositives);learnerRunner.setLengthMultiplier(lengthMultiplier);
                  learnerRunner.setSelectionID(selection+"_states"+states+"_sample"+sample);
                  runner.submit(learnerRunner);
                  ++numberOfTasks;
                }
              ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection, numberOfTasks);
              for(int count=0;count < numberOfTasks;++count)
              {
                ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
                if (gr_NewToOrig != null)
                {
                  for(SampleData sample:result.samples)
                    gr_NewToOrig.add(sample.referenceLearner.getValue(),sample.actualLearner.getValue());
                }
               
                for(SampleData sample:result.samples)
                  if (sample.referenceLearner.getValue() > 0)
                    gr_QualityForNumberOfTraces.add(traceQuantity+"",sample.actualLearner.getValue()/sample.referenceLearner.getValue());
                progress.next();
              }
              if (gr_PairQuality != null)
              {
                synchronized(pairQualityCounter)
                {
                  updateGraph(gr_PairQuality,pairQualityCounter);
                  //gr_PairQuality.drawInteractive(gr);
                  //gr_NewToOrig.drawInteractive(gr);
                  //if (gr_QualityForNumberOfTraces.size() > 0)
                  //  gr_QualityForNumberOfTraces.drawInteractive(gr);
                }
              }
              if (gr_PairQuality != null) gr_PairQuality.drawPdf(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_NewToOrig != null) gr_NewToOrig.drawPdf(gr);
            if (gr_QualityForNumberOfTraces != null) gr_QualityForNumberOfTraces.drawPdf(gr);
          }
        }
      }
    if (executorService != null) { executorService.shutdown();executorService = null; }
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

      gr_TimeW_StatesLevel = new RBoxPlot<Pair<Integer,Integer>>("Mutation level,States","Time taken by W",new File("TimeW_statesmutations.pdf")),
      gr_TimeRand_StatesLevel = new RBoxPlot<Pair<Integer,Integer>>("Mutation level,States","Time taken by Random",new File("TimeRand_statesmutations.pdf"));
    RBagPlot gr_Diff_MutationsToOriginal = new RBagPlot("Mutations/Original Edges","patch size",new File("diff_mutations.pdf")),
      gr_Diff_W = new RBagPlot("W f-measure","patch size",new File("diff_w.pdf")),
      gr_Diff_MismatchedPairs = new RBagPlot("Mismatched key pairs","Diff/Mutations",new File("diff_pairs.pdf"));
    SquareBagPlot gr_F_measures = new SquareBagPlot("W f-measure", "Linear f-measure", new File("f_measure_w_linear.pdf"),0,1,true),
      gr_Rand_W = new SquareBagPlot("W f-measure","Rand f-measure",new File("f_measure_rand_W.pdf"),0,1,true);
    int approxLimit = 3000;
    gr_Diff_MutationsToOriginal.setLimit(approxLimit);
    gr_Diff_W.setLimit(approxLimit);
    gr_Rand_W.setLimit(approxLimit);
    gr_Diff_MismatchedPairs.setLimit(approxLimit);
    gr_F_measures.setLimit(approxLimit);
   
    gr_Diff_MutationsToOriginal.setXboundaries(0.,0.5);
    gr_Diff_MutationsToOriginal.setYboundaries(1.,1.15);

    // Useful values of the threshold
    double pairThreshold[] = new double[]{0.2,0.4,0.6,0.8,0.95},lowToHigh[] = new double[]{0.2,0.4,0.6,0.8,0.95};
    RBoxPlot<Double> gr_Diff_threshold = new RBoxPlot<Double>("Threshold values, Low to High ratio = 0.5","ratio of patch size to mutations",new File("diff_threshold.pdf")),
      gr_Diff_lowtohigh = new RBoxPlot<Double>("Low to High values, threshold ratio = 0.7","ratio of patch size to mutations",new File("diff_lowtohigh.pdf"));
    RBoxPlot<Pair<Double,Double>> gr_Diff_thresholdslowhigh = new RBoxPlot<Pair<Double,Double>>("Low to High ratio, Threshold","ratio of patch size to mutations",new File("diff_thresholdlowhigh.pdf"));
    RBoxPlot<Double> gr_Diff_k = new RBoxPlot<Double>("attenuation factor","ratio of patch size to mutations",new File("diff_attenuation.pdf"));
   
    for(int graphComplexity=0;graphComplexity < graphComplexityMax;graphComplexity++)
    {
      int states=initStates+graphComplexity*50;
      int alphabet = states/2;
     
      MachineGenerator mg = new MachineGenerator(states, 40, states/10);
      int mutationsPerStage = (states/2) / 2;
      //System.out.print("\n"+states+": ");
      ProgressIndicator progress = new ProgressIndicator(""+states, mutationStages*experimentsPerMutationCategory);
      for(int mutationStage = 0;mutationStage<mutationStages;mutationStage++)
      {
        for(int experiment=0;experiment<experimentsPerMutationCategory;experiment++)
        {
          ExperimentResult outcome = new ExperimentResult();
          while(!outcome.experimentValid)
          {
            int mutations = mutationsPerStage * (mutationStage+1);
            LearnerGraphND origGraph = mg.nextMachine(alphabet, experiment,config,converter);
            GraphMutator<List<CmpVertex>,LearnerGraphNDCachedData> mutator = new GraphMutator<List<CmpVertex>,LearnerGraphNDCachedData>(origGraph,r);
            mutator.mutate(mutations);
            LearnerGraphND origAfterRenaming = new LearnerGraphND(origGraph.config);
            Map<CmpVertex,CmpVertex> origToNew = copyStatesAndTransitions(origGraph,origAfterRenaming);
            LearnerGraphND mutated = (LearnerGraphND)mutator.getMutated();
            Set<Transition> appliedMutations = new HashSet<Transition>();
            for(Transition tr:mutator.getDiff())
            {
              CmpVertex renamedFrom = origToNew.get(tr.getFrom());if (renamedFrom == null) renamedFrom = tr.getFrom();
              CmpVertex renamedTo = origToNew.get(tr.getTo());if (renamedTo == null) renamedTo = tr.getTo();
              appliedMutations.add(new Transition(renamedFrom,renamedTo,tr.getLabel()));
            }
           
            final double perfectLowToHigh=0.7,perfectThreshold=0.5;
           
            // These experiments are only run for the maximal number of states
            if (graphComplexity == graphComplexityMax-1)
            {
              for(double k:new double[]{0,.2,.4,.6,.8,.95})
              {
                config.setAttenuationK(k);
                config.setGdKeyPairThreshold(0.5);
                config.setGdLowToHighRatio(perfectLowToHigh);
                config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
               
                gr_Diff_k.add(k, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
               
              }

              for(double threshold:new double[]{0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95})
              {
                config.setGdKeyPairThreshold(threshold);
                config.setGdLowToHighRatio(perfectLowToHigh);
                config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
               
                gr_Diff_threshold.add(threshold, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
              }

              for(double lowtohigh:new double[]{0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95})
              {
                config.setGdKeyPairThreshold(perfectThreshold);
                config.setGdLowToHighRatio(lowtohigh);
                config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
               
                gr_Diff_lowtohigh.add(lowtohigh, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
              }
             
             
              for(int i=0;i<pairThreshold.length;++i)
                for(double ratio:lowToHigh)
                {
                  config.setGdKeyPairThreshold(pairThreshold[i]);
                  config.setGdLowToHighRatio(ratio);
                  config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                  linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
                 
                  gr_Diff_thresholdslowhigh.add(new Pair<Double,Double>(ratio,pairThreshold[i]), outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
                }
            }
            config.setAttenuationK(0.5);
            config.setGdKeyPairThreshold(perfectThreshold);
            config.setGdLowToHighRatio(perfectLowToHigh);
            config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
            linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
           
            if (!skip)
            {
              LearnerGraph fromDet = null, toDet = null;
              try {
                fromDet = mergeAndDeterminize(origAfterRenaming);
                toDet = mergeAndDeterminize(mutated);
              } catch (IncompatibleStatesException e) {
                Helper.throwUnchecked("failed to build a deterministic graph from a nondet one", e);
              }
              languageDiff(fromDet,toDet,states, graphComplexity,outcome);
            }
            outcome.experimentValid = true;
            progress.next();
            gr_Diff_States.add(states, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_W_States.add(states,outcome.getValue(DOUBLE_V.ACCURACY_W));
            Pair<Integer,Integer> mutations_states = new Pair<Integer,Integer>(mutationStage+1,states);
            Pair<Integer,Integer> states_mutations = new Pair<Integer,Integer>(states,mutationStage+1);
            gr_DiffGD_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_DiffW_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.ACCURACY_W));
            gr_DiffRand_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.ACCURACY_W));
            gr_MutationsToOriginal_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.MUTATIONS_TO_TRANSITIONS));
            gr_DiffRand_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.ACCURACY_W));
            gr_MismatchedPairs.add(states_mutations,outcome.getValue(DOUBLE_V.MISMATCHED_KEYPAIRS));
            gr_Pairs_States.add(states,outcome.getValue(DOUBLE_V.MISMATCHED_KEYPAIRS));
           
            // Time taken
            long ns = 1000000L;
            gr_TimeDiff_StatesLevel.add(states_mutations, (double)(outcome.getValue(LONG_V.DURATION_GD)/ns));
            gr_TimeW_StatesLevel.add(states_mutations, (double)(outcome.getValue(LONG_V.DURATION_W)/ns));
            gr_TimeRand_StatesLevel.add(states_mutations, (double)(outcome.getValue(LONG_V.DURATION_RAND)/ns));
            gr_TimeDiff_States.add(states,(double)(outcome.getValue(LONG_V.DURATION_GD)/ns));
            gr_TimeW_States.add(states,(double)(outcome.getValue(LONG_V.DURATION_W)/ns));
            gr_TimeRand_States.add(states,(double)(outcome.getValue(LONG_V.DURATION_RAND)/ns));
           
            gr_Diff_MutationsToOriginal.add(outcome.getValue(DOUBLE_V.MUTATIONS_TO_TRANSITIONS),outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_Diff_W.add(outcome.getValue(DOUBLE_V.ACCURACY_W),outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_Rand_W.add(outcome.getValue(DOUBLE_V.ACCURACY_W),outcome.getValue(DOUBLE_V.ACCURACY_RAND));
            gr_Diff_MismatchedPairs.add(outcome.getValue(DOUBLE_V.MISMATCHED_KEYPAIRS),outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_F_measures.add(outcome.getValue(DOUBLE_V.ACCURACY_W), outcome.getValue(DOUBLE_V.ACCURACY_LINEAR));
            gr_FMeasure_Level.add(mutationStage, outcome.getValue(DOUBLE_V.ACCURACY_LINEAR));
          }

        }
        // finished doing this mutation stage, update graphs
        gr_Diff_States.drawInteractive(gr);gr_MutationsToOriginal_StatesLevel.drawInteractive(gr);         
        //gr_Diff_thresholds.drawInteractive(gr);
        //gr_Diff_k.drawInteractive(gr);
        gr_DiffGD_StatesLevel.drawInteractive(gr);gr_DiffW_StatesLevel.drawInteractive(gr);gr_DiffRand_StatesLevel.drawInteractive(gr);
        gr_Diff_MutationsToOriginal.drawInteractive(gr);
        gr_W_States.drawInteractive(gr);
        gr_Diff_W.drawInteractive(gr);
        gr_Rand_W.drawInteractive(gr);
        gr_FMeasure_Level.drawInteractive(gr);
        //gr_TimeDiff_StatesLevel.drawInteractive(gr);gr_TimeW_StatesLevel.drawInteractive(gr);gr_TimeRand_StatesLevel.drawInteractive(gr);
        //gr_MismatchedPairs.drawInteractive(gr);
        gr_Pairs_States.drawInteractive(gr);gr_TimeDiff_States.drawInteractive(gr);gr_TimeRand_States.drawInteractive(gr);gr_TimeW_States.drawInteractive(gr);
        gr_F_measures.drawInteractive(gr);
        //if (mutationStage>0) gr_Diff_MismatchedPairs.drawInteractive(gr);
       
        //ExperimentResult average = getAverage(accuracyStruct,graphComplexity,mutationStage);
        //arrayWithDiffResults.add(diffValues);arrayWithKeyPairsResults.add(keyPairsValues);
        //arrayWithResultNames.add(""+states+"-"+Math.round(100*average.mutationsToTransitions)+"%");
        //System.out.print("["+average+"]");
       
       
        //List<String> names=arrayWithResultNames.size()>1?arrayWithResultNames:null;
      }

    }
    gr_Diff_States.drawPdf(gr);gr_W_States.drawPdf(gr);gr_MutationsToOriginal_StatesLevel.drawPdf(gr);
    gr_Diff_threshold.drawPdf(gr);gr_Diff_lowtohigh.drawPdf(gr);gr_Diff_thresholdslowhigh.drawPdf(gr);gr_Diff_k.drawPdf(gr);
    gr_Diff_MutationsToOriginal.drawPdf(gr);
    gr_DiffGD_StatesLevel.drawPdf(gr);gr_DiffW_StatesLevel.drawPdf(gr);gr_DiffRand_StatesLevel.drawPdf(gr);
    gr_Diff_W.drawPdf(gr);gr_Rand_W.drawPdf(gr);
    gr_MismatchedPairs.drawPdf(gr);gr_Diff_MismatchedPairs.drawPdf(gr);
   
    gr_TimeDiff_StatesLevel.drawPdf(gr);gr_TimeW_StatesLevel.drawPdf(gr);gr_TimeRand_StatesLevel.drawPdf(gr);
    gr_Pairs_States.drawPdf(gr);gr_TimeDiff_States.drawPdf(gr);gr_TimeRand_States.drawPdf(gr);gr_TimeW_States.drawPdf(gr);
    gr_F_measures.drawPdf(gr);
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

                ";selectingRed="+selectingRed+";classifierToBlockAllMergers="+classifierToBlockAllMergers+";zeroScoringAsRed="+zeroScoringAsRed+";traceQuantity="+traceQuantity+";lengthMultiplier="+lengthMultiplier+";trainingDataMultiplier="+trainingDataMultiplier+";";

            final int totalTaskNumber = traceQuantity;
            final RBoxPlot<Long> gr_PairQuality = new RBoxPlot<Long>("Correct v.s. wrong","%%",new File("percentage_score"+selection+".pdf"));
            final RBoxPlot<String> gr_QualityForNumberOfTraces = new RBoxPlot<String>("traces","%%",new File("quality_traces"+selection+".pdf"));
            SquareBagPlot gr_NewToOrig = new SquareBagPlot("orig score","score with learnt selection",new File("new_to_orig"+selection+".pdf"),0,1,true);
            final Map<Long,TrueFalseCounter> pairQualityCounter = new TreeMap<Long,TrueFalseCounter>();
            try
            {
              int numberOfTasks = 0;
              for(int states=minStateNumber;states < minStateNumber+rangeOfStateNumbers;states+=stateNumberIncrement)
                for(int sample=0;sample<samplesPerFSM;++sample)
                {
                  LearnerRunner learnerRunner = new LearnerRunner(dataCollector,states,sample,totalTaskNumber+numberOfTasks,traceQuantity, config, converter)
                  {
                    @Override
                    public LearnerThatCanClassifyPairs createLearner(LearnerEvaluationConfiguration evalCnf,LearnerGraph argReferenceGraph,@SuppressWarnings("unused") WekaDataCollector argDataCollector,  LearnerGraph argInitialPTA)
                    {
                      LearnerThatUsesWekaResults l = new LearnerThatUsesWekaResults(ifDepth,evalCnf,argReferenceGraph,classifier,argInitialPTA);
                      if (gr_PairQuality != null)
                        l.setPairQualityCounter(pairQualityCounter);
                     
                      l.setUseClassifierForRed(selectingRed);l.setUseClassifierToChooseNextRed(classifierToBlockAllMergers);
                      l.setBlacklistZeroScoringPairs(zeroScoringAsRed);
                      l.setThreshold(threshold);
                      return l;
                    }
                   
                  };
                  learnerRunner.setPickUniqueFromInitial(useUnique);learnerRunner.setEvaluateAlsoUsingReferenceLearner(true);
                  learnerRunner.setOnlyUsePositives(onlyPositives);learnerRunner.setIfdepth(ifDepth);learnerRunner.setLengthMultiplier(lengthMultiplier);
                  learnerRunner.setSelectionID(selection+"_states"+states+"_sample"+sample);
                  runner.submit(learnerRunner);
                  ++numberOfTasks;
                }
              ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection, numberOfTasks);
              for(int count=0;count < numberOfTasks;++count)
              {
                ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
                if (gr_NewToOrig != null)
                {
                  for(SampleData sample:result.samples)
                    gr_NewToOrig.add(sample.referenceLearner.getValue(),sample.actualLearner.getValue());
                }
               
                for(SampleData sample:result.samples)
                  if (sample.referenceLearner.getValue() > 0)
                    gr_QualityForNumberOfTraces.add(traceQuantity+"",sample.actualLearner.getValue()/sample.referenceLearner.getValue());
                progress.next();
              }
              if (gr_PairQuality != null)
              {
                synchronized(pairQualityCounter)
                {
                  updateGraph(gr_PairQuality,pairQualityCounter);
                  //gr_PairQuality.drawInteractive(gr);
                  //gr_NewToOrig.drawInteractive(gr);
                  //if (gr_QualityForNumberOfTraces.size() > 0)
                  //  gr_QualityForNumberOfTraces.drawInteractive(gr);
                }
              }
              if (gr_PairQuality != null) gr_PairQuality.drawPdf(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_NewToOrig != null) gr_NewToOrig.drawPdf(gr);
            if (gr_QualityForNumberOfTraces != null) gr_QualityForNumberOfTraces.drawPdf(gr);
          }
        }
      }
    if (executorService != null) { executorService.shutdown();executorService = null; }
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

    final Map<Integer,RBoxPlot<String>> gr_BCRImprovementForDifferentTraces = new  TreeMap<Integer,RBoxPlot<String>>();
    final Map<Integer,SquareBagPlot> gr_BCR_EM_against_Sicco = new TreeMap<Integer,SquareBagPlot>();
    for(final int traceQuantity:traceQuantityValues)
    {
      gr_BCRImprovementForDifferentTraces.put(traceQuantity, new RBoxPlot<String>("Different Learners","BCR",new File("BCR"+"_traceQuantity_"+traceQuantity+".pdf")));
      gr_BCR_EM_against_Sicco.put(traceQuantity,new SquareBagPlot("BCR, SiccoN","BCR, EDSM-Markov learner",new File("improvement_"+traceQuantity+".pdf"),0.5,1,true));
    }   
   
    List<RGraph> graphs = new LinkedList<RGraph>();graphs.addAll(gr_BCRImprovementForDifferentTraces.values());graphs.addAll(gr_BCR_EM_against_Sicco.values());
    final RGraph[] graphsInExperiment = graphs.toArray(new RGraph[]{});
   
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

                ";onlyPositives="+onlyPositives+";selectingRed="+selectingRed+";classifierToBlockAllMergers="+classifierToBlockAllMergers+";zeroScoringAsRed="+zeroScoringAsRed+";lengthMultiplier="+lengthMultiplier+";";

            final int totalTaskNumber = traceQuantity;
            final RBoxPlot<Long> gr_PairQuality = new RBoxPlot<Long>("Correct v.s. wrong","%%",new File("percentage_score"+selection.substring(0, 80)+".pdf"));
            final RBoxPlot<String> gr_QualityForNumberOfTraces = new RBoxPlot<String>("traces","%%",new File("quality_traces"+selection.substring(0, 80)+".pdf"));
            SquareBagPlot gr_NewToOrig = new SquareBagPlot("orig score","score with learnt selection",new File("new_to_orig"+selection.substring(0, 80)+".pdf"),0,1,true);
            final Map<Long,TrueFalseCounter> pairQualityCounter = new TreeMap<Long,TrueFalseCounter>();
            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,totalTaskNumber+numberOfTasks,traceQuantity, config, converter);
                  learnerRunner.setPickUniqueFromInitial(useUnique);
                  learnerRunner.setOnlyUsePositives(onlyPositives);learnerRunner.setLengthMultiplier(lengthMultiplier);
                  learnerRunner.setSelectionID(selection+"_states"+states+"_sample"+sample);
                  runner.submit(learnerRunner);
                  ++numberOfTasks;
                }
              ProgressIndicator progress = new ProgressIndicator(new Date()+" evaluating "+numberOfTasks+" tasks for "+selection, numberOfTasks);
              for(int count=0;count < numberOfTasks;++count)
              {
                ThreadResult result = runner.take().get();// this will throw an exception if any of the tasks failed.
                if (gr_NewToOrig != null)
                {
                  for(SampleData sample:result.samples)
                    gr_NewToOrig.add(sample.differenceForReferenceLearner.getValue(),sample.difference.getValue());
                }
               
                for(SampleData sample:result.samples)
                  if (sample.differenceForReferenceLearner.getValue() > 0)
                    gr_QualityForNumberOfTraces.add(traceQuantity+"",sample.difference.getValue()/sample.differenceForReferenceLearner.getValue());
                progress.next();
              }
              if (gr_PairQuality != null)
              {
                synchronized(pairQualityCounter)
                {
                  updateGraph(gr_PairQuality,pairQualityCounter);
                  //gr_PairQuality.drawInteractive(gr);
                  //gr_NewToOrig.drawInteractive(gr);
                  //if (gr_QualityForNumberOfTraces.size() > 0)
                  //  gr_QualityForNumberOfTraces.drawInteractive(gr);
                }
              }
              if (gr_PairQuality != null) gr_PairQuality.drawPdf(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_NewToOrig != null) gr_NewToOrig.drawPdf(gr);
            if (gr_QualityForNumberOfTraces != null) gr_QualityForNumberOfTraces.drawPdf(gr);
          }
        }
      }
    if (executorService != null) { executorService.shutdown();executorService = null; }
View Full Code Here

Examples of statechum.analysis.learning.DrawGraphs.SquareBagPlot

      gr_TimeW_StatesLevel = new RBoxPlot<Pair<Integer,Integer>>("Mutation level,States","Time taken by W",new File("TimeW_statesmutations.pdf")),
      gr_TimeRand_StatesLevel = new RBoxPlot<Pair<Integer,Integer>>("Mutation level,States","Time taken by Random",new File("TimeRand_statesmutations.pdf"));
    RBagPlot gr_Diff_MutationsToOriginal = new RBagPlot("Mutations/Original Edges","patch size",new File("diff_mutations.pdf")),
      gr_Diff_W = new RBagPlot("W f-measure","patch size",new File("diff_w.pdf")),
      gr_Diff_MismatchedPairs = new RBagPlot("Mismatched key pairs","Diff/Mutations",new File("diff_pairs.pdf"));
    SquareBagPlot gr_F_measures = new SquareBagPlot("W f-measure", "Linear f-measure", new File("f_measure_w_linear.pdf"),0,1,true),
      gr_Rand_W = new SquareBagPlot("W f-measure","Rand f-measure",new File("f_measure_rand_W.pdf"),0,1,true);
    int approxLimit = 3000;
    gr_Diff_MutationsToOriginal.setLimit(approxLimit);
    gr_Diff_W.setLimit(approxLimit);
    gr_Rand_W.setLimit(approxLimit);
    gr_Diff_MismatchedPairs.setLimit(approxLimit);
    gr_F_measures.setLimit(approxLimit);
   
    gr_Diff_MutationsToOriginal.setXboundaries(0.,0.5);
    gr_Diff_MutationsToOriginal.setYboundaries(1.,1.15);

    // Useful values of the threshold
    double pairThreshold[] = new double[]{0.2,0.4,0.6,0.8,0.95},lowToHigh[] = new double[]{0.2,0.4,0.6,0.8,0.95};
    RBoxPlot<Double> gr_Diff_threshold = new RBoxPlot<Double>("Threshold values, Low to High ratio = 0.5","ratio of patch size to mutations",new File("diff_threshold.pdf")),
      gr_Diff_lowtohigh = new RBoxPlot<Double>("Low to High values, threshold ratio = 0.7","ratio of patch size to mutations",new File("diff_lowtohigh.pdf"));
    RBoxPlot<Pair<Double,Double>> gr_Diff_thresholdslowhigh = new RBoxPlot<Pair<Double,Double>>("Low to High ratio, Threshold","ratio of patch size to mutations",new File("diff_thresholdlowhigh.pdf"));
    RBoxPlot<Double> gr_Diff_k = new RBoxPlot<Double>("attenuation factor","ratio of patch size to mutations",new File("diff_attenuation.pdf"));
   
    for(int graphComplexity=0;graphComplexity < graphComplexityMax;graphComplexity++)
    {
      int states=initStates+graphComplexity*50;
      int alphabet = states/2;
     
      MachineGenerator mg = new MachineGenerator(states, 40, states/10);
      int mutationsPerStage = (states/2) / 2;
      //System.out.print("\n"+states+": ");
      ProgressIndicator progress = new ProgressIndicator(""+states, mutationStages*experimentsPerMutationCategory);
      for(int mutationStage = 0;mutationStage<mutationStages;mutationStage++)
      {
        for(int experiment=0;experiment<experimentsPerMutationCategory;experiment++)
        {
          ExperimentResult outcome = new ExperimentResult();
          while(!outcome.experimentValid)
          {
            int mutations = mutationsPerStage * (mutationStage+1);
            LearnerGraphND origGraph = mg.nextMachine(alphabet, experiment,config);
            GraphMutator<List<CmpVertex>,LearnerGraphNDCachedData> mutator = new GraphMutator<List<CmpVertex>,LearnerGraphNDCachedData>(origGraph,r);
            mutator.mutate(mutations);
            LearnerGraphND origAfterRenaming = new LearnerGraphND(origGraph.config);
            Map<CmpVertex,CmpVertex> origToNew = copyStatesAndTransitions(origGraph,origAfterRenaming);
            LearnerGraphND mutated = (LearnerGraphND)mutator.getMutated();
            Set<Transition> appliedMutations = new HashSet<Transition>();
            for(Transition tr:mutator.getDiff())
            {
              CmpVertex renamedFrom = origToNew.get(tr.getFrom());if (renamedFrom == null) renamedFrom = tr.getFrom();
              CmpVertex renamedTo = origToNew.get(tr.getTo());if (renamedTo == null) renamedTo = tr.getTo();
              appliedMutations.add(new Transition(renamedFrom,renamedTo,tr.getLabel()));
            }
           
            final double perfectLowToHigh=0.7,perfectThreshold=0.5;
           
            // These experiments are only run for the maximal number of states
            if (graphComplexity == graphComplexityMax-1)
            {
              for(double k:new double[]{0,.2,.4,.6,.8,.95})
              {
                config.setAttenuationK(k);
                config.setGdKeyPairThreshold(0.5);
                config.setGdLowToHighRatio(perfectLowToHigh);
                config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
               
                gr_Diff_k.add(k, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
               
              }

              for(double threshold:new double[]{0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95})
              {
                config.setGdKeyPairThreshold(threshold);
                config.setGdLowToHighRatio(perfectLowToHigh);
                config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
               
                gr_Diff_threshold.add(threshold, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
              }

              for(double lowtohigh:new double[]{0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,0.95})
              {
                config.setGdKeyPairThreshold(perfectThreshold);
                config.setGdLowToHighRatio(lowtohigh);
                config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
               
                gr_Diff_lowtohigh.add(lowtohigh, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
              }
             
             
              for(int i=0;i<pairThreshold.length;++i)
                for(double ratio:lowToHigh)
                {
                  config.setGdKeyPairThreshold(pairThreshold[i]);
                  config.setGdLowToHighRatio(ratio);
                  config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
                  linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
                 
                  gr_Diff_thresholdslowhigh.add(new Pair<Double,Double>(ratio,pairThreshold[i]), outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
                }
            }
            config.setAttenuationK(0.5);
            config.setGdKeyPairThreshold(perfectThreshold);
            config.setGdLowToHighRatio(perfectLowToHigh);
            config.setGdPropagateDet(false);// this is to ensure that if we removed a transition 0 from to a state and then added one from that state to a different one, det-propagation will not force the two very different states into a key-pair relation.
            linearDiff(origAfterRenaming,mutated, appliedMutations,outcome);
           
            if (!skip)
            {
              LearnerGraph fromDet = null, toDet = null;
              try {
                fromDet = mergeAndDeterminize(origAfterRenaming);
                toDet = mergeAndDeterminize(mutated);
              } catch (IncompatibleStatesException e) {
                Helper.throwUnchecked("failed to build a deterministic graph from a nondet one", e);
              }
              languageDiff(fromDet,toDet,states, graphComplexity,outcome);
            }
            outcome.experimentValid = true;
            progress.next();
            gr_Diff_States.add(states, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_W_States.add(states,outcome.getValue(DOUBLE_V.ACCURACY_W));
            Pair<Integer,Integer> mutations_states = new Pair<Integer,Integer>(mutationStage+1,states);
            Pair<Integer,Integer> states_mutations = new Pair<Integer,Integer>(states,mutationStage+1);
            gr_DiffGD_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_DiffW_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.ACCURACY_W));
            gr_DiffRand_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.ACCURACY_W));
            gr_MutationsToOriginal_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.MUTATIONS_TO_TRANSITIONS));
            gr_DiffRand_StatesLevel.add(mutations_states, outcome.getValue(DOUBLE_V.ACCURACY_W));
            gr_MismatchedPairs.add(states_mutations,outcome.getValue(DOUBLE_V.MISMATCHED_KEYPAIRS));
            gr_Pairs_States.add(states,outcome.getValue(DOUBLE_V.MISMATCHED_KEYPAIRS));
           
            // Time taken
            long ns = 1000000L;
            gr_TimeDiff_StatesLevel.add(states_mutations, (double)(outcome.getValue(LONG_V.DURATION_GD)/ns));
            gr_TimeW_StatesLevel.add(states_mutations, (double)(outcome.getValue(LONG_V.DURATION_W)/ns));
            gr_TimeRand_StatesLevel.add(states_mutations, (double)(outcome.getValue(LONG_V.DURATION_RAND)/ns));
            gr_TimeDiff_States.add(states,(double)(outcome.getValue(LONG_V.DURATION_GD)/ns));
            gr_TimeW_States.add(states,(double)(outcome.getValue(LONG_V.DURATION_W)/ns));
            gr_TimeRand_States.add(states,(double)(outcome.getValue(LONG_V.DURATION_RAND)/ns));
           
            gr_Diff_MutationsToOriginal.add(outcome.getValue(DOUBLE_V.MUTATIONS_TO_TRANSITIONS),outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_Diff_W.add(outcome.getValue(DOUBLE_V.ACCURACY_W),outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_Rand_W.add(outcome.getValue(DOUBLE_V.ACCURACY_W),outcome.getValue(DOUBLE_V.ACCURACY_RAND));
            gr_Diff_MismatchedPairs.add(outcome.getValue(DOUBLE_V.MISMATCHED_KEYPAIRS),outcome.getValue(DOUBLE_V.OBTAINED_TO_EXPECTED));
            gr_F_measures.add(outcome.getValue(DOUBLE_V.ACCURACY_W), outcome.getValue(DOUBLE_V.ACCURACY_LINEAR));
            gr_FMeasure_Level.add(mutationStage, outcome.getValue(DOUBLE_V.ACCURACY_LINEAR));
          }

        }
        // finished doing this mutation stage, update graphs
        gr_Diff_States.drawInteractive(gr);gr_MutationsToOriginal_StatesLevel.drawInteractive(gr);         
        //gr_Diff_thresholds.drawInteractive(gr);
        //gr_Diff_k.drawInteractive(gr);
        gr_DiffGD_StatesLevel.drawInteractive(gr);gr_DiffW_StatesLevel.drawInteractive(gr);gr_DiffRand_StatesLevel.drawInteractive(gr);
        gr_Diff_MutationsToOriginal.drawInteractive(gr);
        gr_W_States.drawInteractive(gr);
        gr_Diff_W.drawInteractive(gr);
        gr_Rand_W.drawInteractive(gr);
        gr_FMeasure_Level.drawInteractive(gr);
        //gr_TimeDiff_StatesLevel.drawInteractive(gr);gr_TimeW_StatesLevel.drawInteractive(gr);gr_TimeRand_StatesLevel.drawInteractive(gr);
        //gr_MismatchedPairs.drawInteractive(gr);
        gr_Pairs_States.drawInteractive(gr);gr_TimeDiff_States.drawInteractive(gr);gr_TimeRand_States.drawInteractive(gr);gr_TimeW_States.drawInteractive(gr);
        gr_F_measures.drawInteractive(gr);
        //if (mutationStage>0) gr_Diff_MismatchedPairs.drawInteractive(gr);
       
        //ExperimentResult average = getAverage(accuracyStruct,graphComplexity,mutationStage);
        //arrayWithDiffResults.add(diffValues);arrayWithKeyPairsResults.add(keyPairsValues);
        //arrayWithResultNames.add(""+states+"-"+Math.round(100*average.mutationsToTransitions)+"%");
        //System.out.print("["+average+"]");
       
       
        //List<String> names=arrayWithResultNames.size()>1?arrayWithResultNames:null;
      }

    }
    gr_Diff_States.drawPdf(gr);gr_W_States.drawPdf(gr);gr_MutationsToOriginal_StatesLevel.drawPdf(gr);
    gr_Diff_threshold.drawPdf(gr);gr_Diff_lowtohigh.drawPdf(gr);gr_Diff_thresholdslowhigh.drawPdf(gr);gr_Diff_k.drawPdf(gr);
    gr_Diff_MutationsToOriginal.drawPdf(gr);
    gr_DiffGD_StatesLevel.drawPdf(gr);gr_DiffW_StatesLevel.drawPdf(gr);gr_DiffRand_StatesLevel.drawPdf(gr);
    gr_Diff_W.drawPdf(gr);gr_Rand_W.drawPdf(gr);
    gr_MismatchedPairs.drawPdf(gr);gr_Diff_MismatchedPairs.drawPdf(gr);
   
    gr_TimeDiff_StatesLevel.drawPdf(gr);gr_TimeW_StatesLevel.drawPdf(gr);gr_TimeRand_StatesLevel.drawPdf(gr);
    gr_Pairs_States.drawPdf(gr);gr_TimeDiff_States.drawPdf(gr);gr_TimeRand_States.drawPdf(gr);gr_TimeW_States.drawPdf(gr);
    gr_F_measures.drawPdf(gr);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.