Package statechum.model.testset

Examples of statechum.model.testset.PTA_computePrecisionRecall


    PTASequenceEngine engine = new PTA_FSMStructure(mach,null);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(TestFSMAlgo.buildSet(new String[][] {
        new String[] {"a","a","a","b"}, // +
      },mainConfiguration,converter));
    PTA_computePrecisionRecall precComputer = new PTA_computePrecisionRecall(fsm);
    precComputer.crossWith(engine);
   
    engine = new PTA_FSMStructure(mach,null);
    partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(TestFSMAlgo.buildSet(new String[][] {
        new String[] {"a","a","a","b"}, // +
      },mainConfiguration,converter));
    precComputer.crossWith(engine);
    assertEquals("true negatives",0, precComputer.resultTN);assertEquals("true positives",0, precComputer.resultTP);
    assertEquals("false negatives",0, precComputer.resultFN);assertEquals("false positives",0, precComputer.resultFP);
    assertEquals("positives relevant",0, precComputer.pos_Rel);assertEquals("negatives relevant",0, precComputer.neg_Rel);
    assertEquals("positives retrieved",0, precComputer.pos_Ret);assertEquals("negatives retrieved",0, precComputer.neg_Ret);
  }
View Full Code Here


    PTASequenceEngine engine = new PTA_FSMStructure(mach,null);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(TestFSMAlgo.buildSet(new String[][] {
        new String[] {"a","a","a","a","b"}, new String[]{"b"}, new String[]{"a", "b", "c"}, new String[]{"a", "b", "a"}
      },mainConfiguration,converter));
    PTA_computePrecisionRecall precComputer = new PTA_computePrecisionRecall(fsm);
    precComputer.crossWith(engine);
    precComputer.crossWith(engine);
    assertEquals("true negatives",0, precComputer.resultTN);assertEquals("true positives",0, precComputer.resultTP);
    assertEquals("false negatives",0, precComputer.resultFN);assertEquals("false positives",0, precComputer.resultFP);
    assertEquals("positives relevant",0, precComputer.pos_Rel);assertEquals("negatives relevant",0, precComputer.neg_Rel);
    assertEquals("positives retrieved",0, precComputer.pos_Ret);assertEquals("negatives retrieved",0, precComputer.neg_Ret);
  }
View Full Code Here

      initSet = initSet.crossWithSet(alphabet);
   
    // Second, we run them on both graphs
   
    PosNegPrecisionRecall bruteForcePR = computePrecisionRecall(graph, sequences);
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(graph);
    precRec.crossWith(sequences);
    PosNegPrecisionRecall actualPR = precRec.getPosNegPrecisionRecallNum();
   
    // Third, we compare precision/recall computed in two different ways
   
    assertEquals("pos precision",bruteForcePR.getPosprecision(), actualPR.getPosprecision(),Configuration.fpAccuracy);
    assertEquals("pos recall",bruteForcePR.getPosrecall(), actualPR.getPosrecall(),Configuration.fpAccuracy);
View Full Code Here

            (testSequencesB==null?"NONE":testSequencesB.getData(PTASequenceEngine.truePred)));
        */
       
        double bcrA = 0., bcrB= 0.;
        {
          PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(stateToCorrespondingGraph.get(stateA).graph);
          if (testSequencesB != null) precRec.crossWith(testSequencesB);
          bcrA=precRec.getBCR();
        }
        {
          PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(stateToCorrespondingGraph.get(stateB).graph);
          if (testSequencesA != null) precRec.crossWith(testSequencesA);
          bcrB=precRec.getBCR();
        }
        double multiplier = 100.;
        if (config.getGdScoreComputation() == GDScoreComputationEnum.GD_RH)
          rightHandSide = multiplier*(bcrA+bcrB)*totalOutgoing/2.;
        else
 
View Full Code Here

    PosNegPrecisionRecall pr = compare(specfsm, wm);
    System.out.println(pr.getPosprecision()+", "+pr.getPosrecall()+", "+pr.getNegprecision()+", "+pr.getNegrecall());
  }
 
  public static PosNegPrecisionRecall compare(LearnerGraph specfsm, LearnerGraph imp){
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(imp);
    PTASequenceEngine engine = new PTA_FSMStructure(specfsm);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(specfsm.wmethod.getFullTestSet(1));
    return precRec.crossWith(engine);
  }
View Full Code Here

    partialPTA = partialPTA.cross(specfsm.wmethod.getFullTestSet(1));
    return precRec.crossWith(engine);
  }
 
  public static PosNegPrecisionRecall compare(Collection<List<String>> tests, LearnerGraph specfsm, LearnerGraph imp){
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(imp);
    PTASequenceEngine engine = new PTA_FSMStructure(specfsm);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(tests);
    return precRec.crossWith(engine);
  }
View Full Code Here

            (testSequencesB==null?"NONE":testSequencesB.getData(PTASequenceEngine.truePred)));
        */
       
        double bcrA = 0., bcrB= 0.;
        {
          PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(stateToCorrespondingGraph.get(stateA).graph);
          if (testSequencesB != null) precRec.crossWith(testSequencesB);
          bcrA=precRec.getBCR();
        }
        {
          PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(stateToCorrespondingGraph.get(stateB).graph);
          if (testSequencesA != null) precRec.crossWith(testSequencesA);
          bcrB=precRec.getBCR();
        }
        if (config.getGdScoreComputation() == GDScoreComputationEnum.GD_RH)
          rightHandSide = (bcrA+bcrB)*totalOutgoing/2.;
        else
          rightHandSide = (bcrA+bcrB)/2.;
View Full Code Here

    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(TestFSMAlgo.buildSet(new String[][] {
        new String[] {"a","a","a"}, // +
        new String[]{"b"}      // -
      },mainConfiguration,converter));
    PTA_computePrecisionRecall precComputer = new PTA_computePrecisionRecall(fsm);
    precComputer.crossWith(engine);
    assertEquals("true negatives",1, precComputer.resultTN);assertEquals("true positives",1, precComputer.resultTP);
    assertEquals("false negatives",0, precComputer.resultFN);assertEquals("false positives",0, precComputer.resultFP);
    assertEquals("positives relevant",1, precComputer.pos_Rel);assertEquals("negatives relevant",1, precComputer.neg_Rel);
    assertEquals("positives retrieved",1, precComputer.pos_Ret);assertEquals("negatives retrieved",1, precComputer.neg_Ret);
  }
View Full Code Here

    partialPTA = partialPTA.cross(TestFSMAlgo.buildSet(new String[][] {
        new String[] {"a","a","a"},// +
        new String[]{"b"},      // -
        new String[]{"a", "b"// -, FP
      },mainConfiguration,converter));
    PTA_computePrecisionRecall precComputer = new PTA_computePrecisionRecall(fsm);
    precComputer.crossWith(engine);
    assertEquals("true negatives",1, precComputer.resultTN);assertEquals("true positives",1, precComputer.resultTP);
    assertEquals("false negatives",0, precComputer.resultFN);assertEquals("false positives",1, precComputer.resultFP);
    assertEquals("positives relevant",1, precComputer.pos_Rel);assertEquals("negatives relevant",2, precComputer.neg_Rel);
    assertEquals("positives retrieved",2, precComputer.pos_Ret);assertEquals("negatives retrieved",1, precComputer.neg_Ret);
  }
View Full Code Here

        new String[] {"a","a","a"}, // +
        new String[]{"b"}, // -
        new String[]{"a", "b"} // -, FP
      },mainConfiguration,converter));
    fsm = buildLearnerGraph("Q-a->Q / A-a->B-a->A-b-#C\nB-b->D-c->E\nD-a-#F", "testPrecisionRecall2b",mainConfiguration,converter);
    PTA_computePrecisionRecall precComputer = new PTA_computePrecisionRecall(fsm,fsm.findVertex(VertexID.parseID("A")));
    precComputer.crossWith(engine);
    assertEquals("true negatives",1, precComputer.resultTN);assertEquals("true positives",1, precComputer.resultTP);
    assertEquals("false negatives",0, precComputer.resultFN);assertEquals("false positives",1, precComputer.resultFP);
    assertEquals("positives relevant",1, precComputer.pos_Rel);assertEquals("negatives relevant",2, precComputer.neg_Rel);
    assertEquals("positives retrieved",2, precComputer.pos_Ret);assertEquals("negatives retrieved",1, precComputer.neg_Ret);
  }
View Full Code Here

TOP

Related Classes of statechum.model.testset.PTA_computePrecisionRecall

Copyright © 2018 www.massapicom. 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.