Package statechum

Examples of statechum.Configuration


   * @param args trace file to load.
     * @throws IOException
   */
  public static void generateHugeArff(final int ifDepth, @SuppressWarnings("unused") String[] args) throws Exception
  {
    final Configuration learnerConfig = Configuration.getDefaultConfiguration().copy();learnerConfig.setGeneralisationThreshold(0);learnerConfig.setGdFailOnDuplicateNames(false);
        learnerConfig.setGdLowToHighRatio(0.75);learnerConfig.setGdKeyPairThreshold(0.5);learnerConfig.setTransitionMatrixImplType(STATETREE.STATETREE_ARRAY);
        learnerConfig.setAskQuestions(false);
       
       final InitialConfigurationAndData initialConfigAndData = PairQualityLearner.loadInitialAndPopulateInitialConfiguration(PairQualityLearner.largePTAFileName, learnerConfig, new Transform.InternStringLabel());

    LearnerGraph referenceGraph = new LearnerGraph(initialConfigAndData.initial.graph.config);AbstractPersistence.loadGraph("resources/largePTA/outcome_correct", referenceGraph, initialConfigAndData.learnerInitConfiguration.getLabelConverter());
      WekaDataCollector dataCollector = PairQualityLearner.createDataCollector(ifDepth);
View Full Code Here


      else
      {// only create a top-level element if writing pure XML.
        outputStream=outStream;
        topElement = doc.createElement(ELEM_KINDS.ELEM_STATECHUM_TESTTRACE.name());doc.appendChild(topElement);topElement.appendChild(Transform322.endl(doc));
      }
      Configuration seriesConfiguration = config.copy();seriesConfiguration.setGdMaxNumberOfStatesInCrossProduct(0);
    }
    catch(ParserConfigurationException e)
    {
      statechum.Helper.throwUnchecked("failed to construct DOM document",e);
    }
View Full Code Here

   * @param gr the graph to save and then load.
   * @throws IOException
   */
  public void checkLoading(LearnerGraph gr) throws IOException
  {
    final Configuration config = Configuration.getDefaultConfiguration();
    StringWriter writer = new StringWriter();gr.transform322.writeGraphML(writer);
    LearnerGraph loaded = LearnerGraph.loadGraph(new StringReader(writer.toString()),config);

    Assert.assertTrue(!gr.wmethod.checkUnreachableStates());Assert.assertTrue(!loaded.wmethod.checkUnreachableStates());
    Assert.assertNull(checkM(gr,loaded));
View Full Code Here

  }

  /** Checks if simply creating vertices we may get an ID with existing number. */
  protected static final boolean ids_are_valid(LearnerGraph gr)
  {
    final Configuration config = gr.config.copy();config.setLearnerCloneGraph(false);
    LearnerGraph graph = gr.copy(config);
   
    // Now we check that we can create lots of vertices and none of their numbers
    // will be included
    {
View Full Code Here

    /** Maps states to a function associating labels to a sum of probabilities from a Markov matrix. Such a sum is supposed to predict the likelyhood of a transition with this label from every state. */
    Map<CmpVertex,Map<Label,UpdatablePairInteger>> state_outgoing_occurence=new HashMap<CmpVertex,Map<Label,UpdatablePairInteger>>();
    /** Maps states to a function associating labels to a probability of a transition with the label of interest from a state of interest. Computed from {@link MarkovUniversalLearner#state_outgoing_occurence}. */
    Map<CmpVertex,Map<Label,UpdatablePairDouble>> state_outgoing=new HashMap<CmpVertex,Map<Label,UpdatablePairDouble>>();

    final Configuration shallowCopy = tentativeAutomaton.config.copy();shallowCopy.setLearnerCloneGraph(false);
    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
View Full Code Here

   * @param predictForwardOrSideways whether to update a forward or a sideways Markov matrix.
   * @param onlyLongest if set, only add traces of <i>chunkLen</i> to Markov matrix. Where false, all prefixes are added as well.
   */
  public void updateMarkov(LearnerGraph tentativeAutomaton, boolean predictForwardOrSideways, boolean onlyLongest)
  {
    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);
View Full Code Here

  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
      Inverse_Graph = Inverse;
    }
    else
View Full Code Here

  public Map<CmpVertex, Map<Label, MarkovOutcome>> predictTransitions(LearnerGraph tentativeAutomaton, boolean predictForwardOrSideways)
  {
    /** Maps states to a function associating labels to a probability of a transition with the label of interest from a state of interest. Computed from {@link MarkovUniversalLearner#state_outgoing_occurence}. */
    Map<CmpVertex,Map<Label,MarkovOutcome>> state_outgoing=new HashMap<CmpVertex,Map<Label,MarkovOutcome>>();

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

  public Map<CmpVertex, Map<Label, MarkovOutcome>> constructMarkovTentative(LearnerGraph tentativeAutomaton, boolean predictForwardOrSideways)
  {
    /** Maps states to a function associating labels to a probability of a transition with the label of interest from a state of interest. Computed from {@link MarkovUniversalLearner#state_outgoing_occurence}. */
    Map<CmpVertex,Map<Label,MarkovOutcome>> state_outgoing=predictTransitions(tentativeAutomaton,predictForwardOrSideways);

    final Configuration shallowCopy = tentativeAutomaton.config.copy();shallowCopy.setLearnerCloneGraph(false);
    Extension_Graph= new LearnerGraph(shallowCopy);
    LearnerGraph.copyGraphs(tentativeAutomaton, Extension_Graph);

    // in this part the tree is extended depend on their outgoing transition probabilities
     for(Entry<CmpVertex, Map<Label, MarkovOutcome>> outgoing:state_outgoing.entrySet())
View Full Code Here

    assert original.transitionMatrix.containsKey(pair.firstElem);
    assert original.transitionMatrix.containsKey(pair.secondElem);
    Map<CmpVertex,List<CmpVertex>> mergedVertices = original.config.getTransitionMatrixImplType() == STATETREE.STATETREE_ARRAY?
        new ArrayMapWithSearch<CmpVertex,List<CmpVertex>>(original.getStateNumber()):
        new HashMapWithSearch<CmpVertex,List<CmpVertex>>(original.getStateNumber());
    Configuration shallowCopy = original.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraph result = new LearnerGraph(original,shallowCopy);
    assert result.transitionMatrix.containsKey(pair.firstElem);
    assert result.transitionMatrix.containsKey(pair.secondElem);

    long pairScore = original.pairscores.computePairCompatibilityScore_internal(pair,mergedVertices);
View Full Code Here

TOP

Related Classes of statechum.Configuration

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.