Class StochasticManifestCollector


  • public class StochasticManifestCollector
    extends java.lang.Object
    Simple analyzer for a manifest based replay.

    Collects statistics of the network given an alignment. Does so by taking into account different semantics.

    Aim is to reconstruct the original model parameters, such that a simulation of the model would give similar results, as observed in the log.

    Problem: some semantics make it hard to reason about the original transition distributions. For example, in the race selection policy, only the winning transitions' time is recorded, and the other transitions that lose a race, might lose their progress depending on the memory policy:

    1.) in the resampling case, these times are lost, and the reconstruction of distributions is hard. 2.) in the enabling memory case, all parallel transitions are fine, as they keep their progress, and only conflicting transitions that lose a race will not leave a trace of their sample in the event log. 3.) the age memory, allows losing transitions to keep their progress, even in conflict. However, if they will not have a chance to finish and fire eventually, before the process ends, their sample durations will be lost, too.

    Learning distributions from data, that is partly censored is possible, and there are some algorithms (e.g., EM-algorithm) that can be used to fit a model to the data. See RCensoredLogSplineDistribution, which provides such functionality through an R-binding.

    In the global preselection policy, only one transition is being processed, such that all other transitions have to wait, even if they are in parallel. Since the distribution times are never hidden, (there is no racing), collecting them is easy. We need to collect information about the weights in each marking and later average the weights out, such that their relation will be in accordance with the observed behavior. See GradientDescent and MarkingBasedSelectionWeightCostFunction in the optimizer package.

    Author:
    Andreas Rogge-Solti
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.Integer,​java.lang.Double> ageVariables
      Stores the age of a transition in model time units since the last sampling period
      protected java.util.Map<java.lang.Integer,​java.util.List<java.lang.Double>> censoredTimes
      stores all censored sample times, where the transition could not use it's sampled duration, because it lost against another.
      static java.lang.String DELIMITER  
      protected gnu.trove.map.hash.TIntObjectHashMap<short[]> encodedTrans2Pred  
      protected gnu.trove.map.hash.TIntObjectHashMap<short[]> encodedTrans2Succ  
      protected java.util.Map<java.lang.Integer,​java.util.List<java.lang.Double>> firingTimes
      stores firing times for transitions
      protected org.processmining.models.graphbased.directed.petrinet.elements.Transition[] idx2Trans
      Mapping the Petri net to integer-encoded numbers
      protected double longestTrace
      Stores the longest trace's duration in time units of the model
      protected org.processmining.plugins.petrinet.manifestreplayresult.ManifestEvClassPattern manifest  
      protected java.util.Map<java.lang.String,​int[]> markingBasedSelections
      for each visited marking, collect the number of times a transition was picked.
      static java.lang.String RELATIVE_DURATION  
      static java.lang.String SYSTEM_LOAD  
      static java.lang.String TIMESTAMP  
    • Field Detail

      • RELATIVE_DURATION

        public static final java.lang.String RELATIVE_DURATION
        See Also:
        Constant Field Values
      • firingTimes

        protected java.util.Map<java.lang.Integer,​java.util.List<java.lang.Double>> firingTimes
        stores firing times for transitions
      • censoredTimes

        protected java.util.Map<java.lang.Integer,​java.util.List<java.lang.Double>> censoredTimes
        stores all censored sample times, where the transition could not use it's sampled duration, because it lost against another.
      • ageVariables

        protected java.util.Map<java.lang.Integer,​java.lang.Double> ageVariables
        Stores the age of a transition in model time units since the last sampling period
      • manifest

        protected org.processmining.plugins.petrinet.manifestreplayresult.ManifestEvClassPattern manifest
      • idx2Trans

        protected org.processmining.models.graphbased.directed.petrinet.elements.Transition[] idx2Trans
        Mapping the Petri net to integer-encoded numbers
      • encodedTrans2Pred

        protected gnu.trove.map.hash.TIntObjectHashMap<short[]> encodedTrans2Pred
      • encodedTrans2Succ

        protected gnu.trove.map.hash.TIntObjectHashMap<short[]> encodedTrans2Succ
      • markingBasedSelections

        protected java.util.Map<java.lang.String,​int[]> markingBasedSelections
        for each visited marking, collect the number of times a transition was picked. the transitions are indexed by their encoded id used in the parent class's #getTrans2Idx() the values in the array are the counts for the different observed next transitions.
      • longestTrace

        protected double longestTrace
        Stores the longest trace's duration in time units of the model
    • Constructor Detail

      • StochasticManifestCollector

        public StochasticManifestCollector​(org.processmining.plugins.petrinet.manifestreplayresult.ManifestEvClassPattern manifest,
                                           PerformanceEnricherConfig config)
    • Method Detail

      • collectDataFromManifest

        public void collectDataFromManifest​(org.deckfour.xes.model.XLog enrichedLog)
      • addTrainingDataLine

        protected void addTrainingDataLine​(java.lang.String trainingDataHeader,
                                           int encTrans,
                                           java.lang.String line)
      • getMeanTraceFitness

        public double getMeanTraceFitness()
      • getMarkingBasedSelections

        public java.util.Map<java.lang.String,​int[]> getMarkingBasedSelections()
      • getEncOfTrans

        public int getEncOfTrans​(org.processmining.models.graphbased.directed.petrinet.elements.Transition t)
      • getDataCount

        public int getDataCount​(int encodedTransID)
      • getFiringTimes

        public java.util.List<java.lang.Double> getFiringTimes​(int indexOfTransition)
      • getTrainingData

        public java.lang.String getTrainingData​(int indexOfTransition)
      • getCensoredFiringTimes

        public java.util.List<java.lang.Double> getCensoredFiringTimes​(int indexOfTransition)
      • getMaxTraceDuration

        public double getMaxTraceDuration()
      • outputCorrelationMatrix

        public void outputCorrelationMatrix()
      • getCaseStatistics

        public CaseStatistics getCaseStatistics​(int caseId)
        Only applicable, if the replay was done on a StochasticNet model.
        Parameters:
        caseId - the position of the trace in the log to be analyzed.
        Returns:
        CaseStatistics including the log-likelihood of the case