Package statechum.analysis.learning.rpnicore

Examples of statechum.analysis.learning.rpnicore.AbstractLearnerGraph


   * @return either an inverse or the original graph
   */
  @SuppressWarnings("rawtypes")
  public static AbstractLearnerGraph computeInverseGraph(LearnerGraph graph,boolean constructInverseOrForward)
  {
    AbstractLearnerGraph inverseGraph = null;
    if (constructInverseOrForward)
    {
      inverseGraph = computeInverseGraph(graph);
    }
    else
View Full Code Here


   * @return either an inverse or the original graph
   */
  @SuppressWarnings("rawtypes")
  public static AbstractLearnerGraph computeInverseGraph(LearnerGraph graph,boolean constructInverseOrForward)
  {
    AbstractLearnerGraph inverseGraph = null;
    if (constructInverseOrForward)
    {
      inverseGraph = computeInverseGraph(graph);
    }
    else
View Full Code Here

   * @return either an inverse or the original graph
   */
  @SuppressWarnings("rawtypes")
  public static AbstractLearnerGraph computeInverseGraph(LearnerGraph graph,boolean constructInverseOrForward)
  {
    AbstractLearnerGraph inverseGraph = null;
    if (constructInverseOrForward)
    {
      inverseGraph = computeInverseGraph(graph);
    }
    else
View Full Code Here

    Extension_Graph= new LearnerGraph(shallowCopy);
    LearnerGraph.copyGraphs(tentativeAutomaton, Extension_Graph);
    Set<Label> allElementsOfAlphabet = tentativeAutomaton.learnerCache.getAlphabet();
    List<Label> pathToNewState=new LinkedList<Label>();
    // mapping map to store all paths leave each state in different length
    @SuppressWarnings("rawtypes")
    AbstractLearnerGraph Inverse_Graph = computeInverseGraph(tentativeAutomaton, predictForward);
    Map<Trace, UpdatablePairInteger> occurrenceMatrix=getOccurrence(predictForward);
      for(Object vertObj:Inverse_Graph.transitionMatrix.keySet())
      {
        CmpVertex vert = (CmpVertex)vertObj;
        if(vert.isAccept() )
            {
            Map<Label,UpdatablePairDouble> outgoing_labels_probabilities=new HashMap<Label,UpdatablePairDouble>();
            Map<Label,UpdatablePairInteger> outgoing_labels_occurrences=new HashMap<Label,UpdatablePairInteger>();
        LinkedList<FrontLineElem> ListofFrontElem=new LinkedList<FrontLineElem>();
        LinkedList<FrontLineElem> frontline = new LinkedList<FrontLineElem>();
              FrontLineElem e=new FrontLineElem(new LinkedList<Label>(),vert);
          frontline.add(e);
          UpdatablePairInteger sum=new UpdatablePairInteger(0,0);
          while(!frontline.isEmpty())
          {
            e=frontline.pop();
           
            @SuppressWarnings("rawtypes")
          Map transitions = (Map)Inverse_Graph.transitionMatrix.get(e.currentState);
            for(Object lblObj:transitions.keySet())         
            {
              Label lbl = (Label)lblObj;
              for(Object targetObj:Inverse_Graph.getTargets(transitions.get(lbl)))
              {
                CmpVertex target = (CmpVertex)targetObj;
                pathToNewState=new ArrayList<Label>();
                pathToNewState.addAll(e.pathToFrontLine);
                pathToNewState.add(lbl);
View Full Code Here

  {
    final Configuration shallowCopy = tentativeAutomaton.config.copy();shallowCopy.setLearnerCloneGraph(false);
    Set<Label> alphabet = tentativeAutomaton.learnerCache.getAlphabet();
    Map<Trace, MarkovOutcome> MarkovMatrix = getMarkov(predictForwardOrSideways);
    Map<Trace, UpdatablePairInteger> occurrenceMatrix = getOccurrence(predictForwardOrSideways);
    @SuppressWarnings("rawtypes")
    AbstractLearnerGraph Inverse_Graph = computeInverseGraph(tentativeAutomaton, predictForwardOrSideways);
      for(CmpVertex vert:tentativeAutomaton.transitionMatrix.keySet())
        for(int len=onlyLongest?chunk_Length:1;len <=chunk_Length;++len)// this is very inefficient; we'll optimize it later if needed.
             if(vert.isAccept())
              updateMarkov(tentativeAutomaton,MarkovMatrix,occurrenceMatrix, Inverse_Graph,predictForwardOrSideways,vert,alphabet,len);
View Full Code Here

   * @return either an inverse or the original graph
   */
  @SuppressWarnings("rawtypes")
  public static AbstractLearnerGraph computeInverseGraph(LearnerGraph graph,boolean predictForward)
  {
    AbstractLearnerGraph Inverse_Graph = null;
    if (predictForward)
    {
      Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
      LearnerGraphND Inverse = new LearnerGraphND(shallowCopy);Inverse.initEmpty();
      AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse)// do the inverse to the tentative graph
View Full Code Here

    final Configuration shallowCopy = tentativeAutomaton.config.copy();shallowCopy.setLearnerCloneGraph(false);
    Set<Label> alphabet = tentativeAutomaton.learnerCache.getAlphabet();
    Map<Trace, MarkovOutcome> MarkovMatrix = getMarkov(predictForwardOrSideways);
    // mapping map to store all paths leave each state in different length
    @SuppressWarnings("rawtypes")
    AbstractLearnerGraph Inverse_Graph = computeInverseGraph(tentativeAutomaton, predictForwardOrSideways);
   
      for(Object vertObj:tentativeAutomaton.transitionMatrix.keySet())
      {
        CmpVertex vert = (CmpVertex)vertObj;
View Full Code Here

    // may be inconsistent with predictions, based on the transitions in the red part of the graph.

    // mapping map to store all paths leave each state in different length
    double tentativeScore=0;
    ConsistencyChecker checker = new MarkovUniversalLearner.InconsistencyNullVsPredicted();
    @SuppressWarnings("rawtypes")
    AbstractLearnerGraph Inverse_Graph = MarkovUniversalLearner.computeInverseGraph(result, predictForward);
    for(Entry<CmpVertex,Collection<Label>> entry:labelsAdded.entrySet())
      if (!entry.getValue().isEmpty())
      {
        double numberOfInconsistencies = Markov.checkFanoutInconsistency(Inverse_Graph,predictForward,result,entry.getKey(),Markov.getChunkLen(), checker);
View Full Code Here

   * @return either an inverse or the original graph
   */
  @SuppressWarnings("rawtypes")
  public static AbstractLearnerGraph computeInverseGraph(LearnerGraph graph,boolean constructInverseOrForward)
  {
    AbstractLearnerGraph inverseGraph = null;
    if (constructInverseOrForward)
    {
      inverseGraph = computeInverseGraph(graph);
    }
    else
View Full Code Here

    Extension_Graph= new LearnerGraph(shallowCopy);
    LearnerGraph.copyGraphs(tentativeAutomaton, Extension_Graph);
    Set<Label> allElementsOfAlphabet = tentativeAutomaton.learnerCache.getAlphabet();
    List<Label> pathToNewState=new LinkedList<Label>();
    // mapping map to store all paths leave each state in different length
    @SuppressWarnings("rawtypes")
    AbstractLearnerGraph Inverse_Graph = computeInverseGraph(tentativeAutomaton, predictForward);
      for(Object vertObj:Inverse_Graph.transitionMatrix.keySet())
      {
        CmpVertex vert = (CmpVertex)vertObj;
        if(vert.isAccept() )
            {
            Map<Label,UpdatablePairDouble> outgoing_labels_probabilities=new HashMap<Label,UpdatablePairDouble>();
            Map<Label,UpdatablePairInteger> outgoing_labels_occurrences=new HashMap<Label,UpdatablePairInteger>();
        LinkedList<FrontLineElem> ListofFrontElem=new LinkedList<FrontLineElem>();
        LinkedList<FrontLineElem> frontline = new LinkedList<FrontLineElem>();
              FrontLineElem e=new FrontLineElem(new LinkedList<Label>(),vert);
          frontline.add(e);
          UpdatablePairInteger sum=new UpdatablePairInteger(0,0);
          while(!frontline.isEmpty())
          {
            e=frontline.pop();
           
            @SuppressWarnings("rawtypes")
          Map transitions = (Map)Inverse_Graph.transitionMatrix.get(e.currentState);
            for(Object lblObj:transitions.keySet())         
            {
              Label lbl = (Label)lblObj;
              for(Object targetObj:Inverse_Graph.getTargets(transitions.get(lbl)))
              {
                CmpVertex target = (CmpVertex)targetObj;
                pathToNewState=new ArrayList<Label>();
                pathToNewState.addAll(e.pathToFrontLine);
                pathToNewState.add(lbl);
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.rpnicore.AbstractLearnerGraph

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.