Package statechum.analysis.learning.MarkovModel.MarkovMatrixEngine

Examples of statechum.analysis.learning.MarkovModel.MarkovMatrixEngine.PredictionForSequence


              if (predictionGraphInverted)
                Collections.reverse(partOfTraceUsedInMarkovPredictions);
              Map<Label,PTASequenceEngine.Node> lastElementToPrediction = model.markovMatrix.getMapFromLabelsToPredictions(partOfTraceUsedInMarkovPredictions);
              for(Label label:allElementsOfAlphabet)
              {
                PredictionForSequence prediction = MarkovMatrixEngine.getPredictionIfExists(lastElementToPrediction,label);

                UpdatablePairInteger occurrence_of_label_predicted_form_Markov=prediction == null?null:prediction.occurrence;

                if(outgoing_labels_occurrences.containsKey(label))
                {
View Full Code Here


        {
          if (!failureLabels.contains(label))
          {// if the labels is not already recorded as being inconsistently predicted
            MarkovOutcome predictedFromEalierTrace = outgoing_labels_probabilities.get(label);
             
              PredictionForSequence prediction = MarkovMatrixEngine.getPredictionIfExists(lastElementToPrediction, label);
              MarkovOutcome predicted_from_Markov= prediction!=null?prediction.prediction:null;
            MarkovOutcome outcome = MarkovOutcome.reconcileOpinions_PosNeg_Overrides_Null(predictedFromEalierTrace, predicted_from_Markov);
            if (outcome != predictedFromEalierTrace)
            {// we learnt something new, be it a new value (or a non-null value) or a failure, record it
              if (outcome == MarkovOutcome.failure)
View Full Code Here

          }
         
          pathToUpdateInMarkov.add(lbl);
         
          MarkovOutcome newValue = null;
          PredictionForSequence prediction = model.markovMatrix.getPredictionAndCreateNewOneIfNecessary(pathToUpdateInMarkov);
         
          boolean foundAccept = false, foundReject = false;
          for(Object vObj:graphToCheckForConsistency.getTargets(targets))
          {
            if ( ((CmpVertex)vObj).isAccept() ) foundAccept = true;
View Full Code Here

            for(Label label:outgoingLabels)
            {
            MarkovOutcome labels_occurrence= outgoing_labels_value.get(label);
            if (labels_occurrence != MarkovOutcome.failure)
            {
                PredictionForSequence prediction = MarkovMatrixEngine.getPredictionIfExists(mapFromLastLabelToNodes, label);
                MarkovOutcome predicted_from_Markov=prediction == null?null:prediction.prediction;
                if (predicted_from_Markov != MarkovOutcome.failure)
                {// if training data does not lead to a consistent outcome for this label because chunk length is too small, not much we can do, but otherwise we are here and can make use of the data
                  if (!checker.consistent(labels_occurrence, predicted_from_Markov))
                  {
View Full Code Here

      }

      @Override
      public void nodeEntered(PTAExplorationNode currentNode,  LinkedList<PTAExplorationNode> pathToInit)
      {
        PredictionForSequence prediction = (PredictionForSequence)currentNode.getState();
        if (pathToInit.size() == WLength && prediction.prediction == MarkovOutcome.positive)
        {
          long countInPTA=prediction.occurrence.firstElem;
          if (countInPTA > maxCount.longValue())
            maxCount.set(countInPTA);
        }
      }

      @Override
      public void leafEntered(PTAExplorationNode currentNode,  LinkedList<PTAExplorationNode> pathToInit)
      {
        nodeEntered(currentNode, pathToInit);
      }

      @Override
      public void nodeLeft(@SuppressWarnings("unused") PTAExplorationNode currentNode, @SuppressWarnings("unused") LinkedList<PTAExplorationNode> pathToInit)
      {
        // nothing to do here.
      }

    };
    exploration.walkThroughAllPaths();

    final Map<Long,List<List<Label>>> thresholdToInconsistency = new TreeMap<Long,List<List<Label>>>();
    exploration = new PTAExploration<Boolean>(model.markovMatrix) {
      @Override
      public Boolean newUserObject() {
        return null;
      }

      @Override
      public void nodeEntered(PTAExplorationNode currentNode,  LinkedList<PTAExplorationNode> pathToInit)
      {
        PredictionForSequence prediction = (PredictionForSequence)currentNode.getState();
        if (pathToInit.size() == WLength && prediction.prediction == MarkovOutcome.positive)
        {
          long countInPTA=prediction.occurrence.firstElem;
          if (countInPTA < maxCount.longValue()/2) // paths that are very common are likely to be present from a number of different states and as such not very good for discriminating between them.
          {
View Full Code Here

      }

      @Override
      public void nodeEntered(PTAExplorationNode currentNode, @SuppressWarnings("unused"LinkedList<PTAExplorationNode> pathToInit)
      {
        PredictionForSequence prediction = (PredictionForSequence)currentNode.getState();
        if (prediction.occurrence.firstElem > 0 && prediction.occurrence.secondElem > 0)
          prediction.prediction = MarkovOutcome.failure;
        else
        if (prediction.occurrence.firstElem > 0)
          prediction.prediction = MarkovOutcome.positive;
View Full Code Here

      }

      @Override
      public void nodeEntered(PTAExplorationNode currentNode, LinkedList<PTAExplorationNode> pathToInit)
      {
        PredictionForSequence prediction = (PredictionForSequence)currentNode.getState();
        LinkedList<Label> path = new LinkedList<Label>();for(PTAExplorationNode elem:pathToInit) path.addFirst(elem.getInput());
        if (prediction.prediction != null)
          outcome.put(path, prediction.prediction);
      }
View Full Code Here

      }

      @Override
      public void nodeEntered(PTAExplorationNode currentNode, LinkedList<PTAExplorationNode> pathToInit)
      {
        PredictionForSequence prediction = (PredictionForSequence)currentNode.getState();
        LinkedList<Label> path = new LinkedList<Label>();for(PTAExplorationNode elem:pathToInit) path.addFirst(elem.getInput());

        if (prediction.prediction != null)
          outcome.put(path, prediction.occurrence);
      }
View Full Code Here

    public static class PredictionStatePTAAutomaton extends PTASequenceSetAutomaton
    {
      @Override
      public Object getTheOnlyState()
      {
        return new PredictionForSequence();// it is important to return a new instance every time it is asked for, because otherwise we'll end up sharing instances that is not right.
      }
View Full Code Here

              if (predictionGraphInverted)
                Collections.reverse(partOfTraceUsedInMarkovPredictions);
              Map<Label,PTASequenceEngine.Node> lastElementToPrediction = model.markovMatrix.getMapFromLabelsToPredictions(partOfTraceUsedInMarkovPredictions);
              for(Label label:allElementsOfAlphabet)
              {
                PredictionForSequence prediction = MarkovMatrixEngine.getPredictionIfExists(lastElementToPrediction,label);

                UpdatablePairInteger occurrence_of_label_predicted_form_Markov=prediction == null?null:prediction.occurrence;

                if(outgoing_labels_occurrences.containsKey(label))
                {
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.MarkovModel.MarkovMatrixEngine.PredictionForSequence

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.