Examples of CmpVertex


Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

  public static List<StatePair> collectionOfSetsToPairs(Collection<Set<CmpVertex>> collectionOfSets)
  {
    List<StatePair> pairsList = new LinkedList<StatePair>();
    for(Collection<CmpVertex> vertices:collectionOfSets)
    {
      CmpVertex prevVertex = null;
      for(CmpVertex v:vertices)
      {
        if (prevVertex != null)
          pairsList.add(new StatePair(prevVertex,v));
        prevVertex = v;
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

    assert graphToPath != null;
    boolean valid = true;
    MarkovClassifier cl = new MarkovClassifier(model,graph);
    for(Set<CmpVertex> set:cl.buildVerticesToMergeForPaths(whatToMerge))
    {
      CmpVertex expected = trimmedReference.getVertex(graphToPath.get(set.iterator().next()));
      for(CmpVertex v:set)
        if (trimmedReference.getVertex(graphToPath.get(v)) != expected)
        {
          valid = false;//System.out.println("INVALID MERGE: "+set);
          break;
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

   
    Set<CmpVertex> uniquelyIdentifiableVertices = new TreeSet<CmpVertex>();
   
    for(Label l:referenceGraph.getCache().getAlphabet())
    {
      CmpVertex vertexIdentified = MarkovPassivePairSelection.checkSeqUniqueOutgoing(referenceGraph,Arrays.asList(new Label[]{l}));
      if(vertexIdentified != null)
        uniquelyIdentifiableVertices.add(vertexIdentified);
    }
   
    return (double)uniquelyIdentifiableVertices.size()/referenceGraph.getStateNumber();
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

   
    Set<CmpVertex> identifiedVertices = new TreeSet<CmpVertex>();
   
    for(List<Label> l:whatToMerge)
    {
      CmpVertex vertexIdentified = MarkovPassivePairSelection.checkSeqUniqueOutgoing(referenceGraph,l);
      if (vertexIdentified != null)
        identifiedVertices.add(vertexIdentified);
    }
   
    return (double)identifiedVertices.size()/referenceGraph.getStateNumber();
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

      if (entry.getKey().isAccept())
      {
        Map<Label, MarkovOutcome> predictions = predictTransitionsFromState(entry.getKey(), null, model.getChunkLen(), null);
        for(Entry<Label,MarkovOutcome> prediction:predictions.entrySet())
        {
          CmpVertex target = entry.getValue().get(prediction.getKey());
          assert prediction.getValue() != MarkovOutcome.failure;
          ++numberOfPredictions;
 
          if (prediction.getValue() == MarkovOutcome.positive)
          {
            if(target != null && target.isAccept())
              ++correctPredictions;
          }
          if (prediction.getValue() == MarkovOutcome.negative)
          {
            if (target == null || !target.isAccept())
              ++correctPredictions;
          }
        }
       
       
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

            if (entry.getValue().isEmpty())
              ++tails;
            if (entry.getValue().size() == 1)
            {
              ++chains;
              CmpVertex target=entry.getValue().values().iterator().next();
              if (actualAutomaton.transitionMatrix.get(target).size() == 1)
                ++doubleChains;
            }
          }
          //System.out.println("Chains: "+chains+" Tails: "+tails+" Double chains: "+doubleChains);
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

    return tracePath_internal(graph,path,0,startState);
  }
 
  public static <TARGET_TYPE,CACHE_TYPE extends CachedData<TARGET_TYPE,CACHE_TYPE>> boolean tracePath_internal(AbstractLearnerGraph<TARGET_TYPE,CACHE_TYPE> graph, List<Label> path, int startPos, CmpVertex startState)
  {
    CmpVertex current = startState;
    if (current == null)
      return false;// if we start from null (such as not found) state, fail immediately.
    if (startPos >= path.size())
      return startState.isAccept();
    if (!startState.isAccept())
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

    for(CmpVertex v:affectedVerticesInGraph)
    {
      visited.put(v, 0);currentExplorationBoundary.offer(v);
    }
   
    CmpVertex explorationElement = null;
    while(!currentExplorationBoundary.isEmpty())
    {
      explorationElement = currentExplorationBoundary.remove();
      int exploredDistance = visited.get(explorationElement)+1;
     
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

      }

        // in this part the tree is extended depending on what we learnt from traces.
         for(Entry<CmpVertex, Map<Label, UpdatablePairDouble>> outgoing:state_outgoing.entrySet())
         {
           CmpVertex currrent_state_to_explore_outgoing= outgoing.getKey();
           Map<Label, UpdatablePairDouble> list_of_outgoing = outgoing.getValue();
           for(Entry<Label, UpdatablePairDouble> out:list_of_outgoing.entrySet())
           {
             Map<Label, CmpVertex> already_outgoing = graph.transitionMatrix.get(currrent_state_to_explore_outgoing);
             assert already_outgoing!=null : "state "+currrent_state_to_explore_outgoing+" is not mentioned in the transition diagram";

             if(!already_outgoing.containsKey(out.getKey()))
             {                  
               if(out.getValue().firstElem >  highThreshold && out.getValue().secondElem <= lowThreshold && currrent_state_to_explore_outgoing.isAccept()==true)
               { 
                 if(!outcome.transitionMatrix.get(currrent_state_to_explore_outgoing).keySet().contains(out.getKey()))
                 {
                   extendWithLabel(outcome,currrent_state_to_explore_outgoing, true, out.getKey());
                 }                    
               }

               if(out.getValue().secondElem >  highThreshold && out.getValue().firstElem <= lowThreshold && currrent_state_to_explore_outgoing.isAccept()==true)
               { 
                 if(!outcome.transitionMatrix.get(currrent_state_to_explore_outgoing).keySet().contains(out.getKey()))
                 {
                   extendWithLabel(outcome,currrent_state_to_explore_outgoing, false, out.getKey());
                 }                    
View Full Code Here

Examples of statechum.DeterministicDirectedSparseGraph.CmpVertex

   * @param isAccept
   * @param input
   */
  public void extendWithLabel(LearnerGraph what, CmpVertex prevState, boolean isAccept, Label input)
  {
    CmpVertex newVertex = AbstractLearnerGraph.generateNewCmpVertex(what.nextID(isAccept),what.config);
    assert !what.transitionMatrix.containsKey(newVertex);
    newVertex.setAccept(isAccept);
    what.transitionMatrix.put(newVertex, what.createNewRow());
    what.addTransition(what.transitionMatrix.get(prevState),input,newVertex);
  }
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.