Changeset 93 for trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
- Timestamp:
- 07/04/11 10:35:39 (13 years ago)
- Location:
- trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/DeterministicFiniteAutomaton.java
r92 r93 19 19 20 20 @Override 21 public double getProbability(List< Event<?>> context, Event<?> symbol) {21 public double getProbability(List<? extends Event<?>> context, Event<?> symbol) { 22 22 double result = 0.0d; 23 23 -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/HighOrderMarkovModel.java
r86 r93 19 19 20 20 @Override 21 public double getProbability(List< Event<?>> context, Event<?> symbol) {21 public double getProbability(List<? extends Event<?>> context, Event<?> symbol) { 22 22 double result = 0.0d; 23 23 -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IStochasticProcess.java
r86 r93 9 9 public interface IStochasticProcess extends Serializable { 10 10 11 double getProbability(List< Event<?>> context, Event<?> symbol);11 double getProbability(List<? extends Event<?>> context, Event<?> symbol); 12 12 13 13 public List<? extends Event<?>> randomSequence(); 14 15 public Set<List<? extends Event<?>>> generateSequences(int length); 14 16 15 17 public int getNumStates(); … … 17 19 public String[] getStateStrings(); 18 20 19 public Set< Event<?>> getEvents();21 public Set<? extends Event<?>> getEvents(); 20 22 21 23 } -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/PredictionByPartialMatch.java
r86 r93 34 34 35 35 @Override 36 public double getProbability(List< Event<?>> context, Event<?> symbol) {36 public double getProbability(List<? extends Event<?>> context, Event<?> symbol) { 37 37 double result = 0.0d; 38 38 double resultCurrentContex = 0.0d; -
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java
r86 r93 1 1 package de.ugoe.cs.eventbench.models; 2 2 3 import java.security.InvalidParameterException; 4 import java.util.ArrayList; 5 import java.util.LinkedHashSet; 3 6 import java.util.LinkedList; 4 7 import java.util.List; … … 104 107 } 105 108 106 public Set< Event<?>> getEvents() {109 public Set<? extends Event<?>> getEvents() { 107 110 return trie.getKnownSymbols(); 111 } 112 113 public Set<List<? extends Event<?>>> generateSequences(int length) { 114 Set<List<? extends Event<?>>> sequenceSet = new LinkedHashSet<List<? extends Event<?>>>();; 115 if( length<1 ) { 116 throw new InvalidParameterException("Length of generated subsequences must be at least 1."); 117 } 118 if( length==1 ) { 119 for( Event<?> event : getEvents() ) { 120 List<Event<?>> subSeq = new LinkedList<Event<?>>(); 121 subSeq.add(event); 122 sequenceSet.add(subSeq); 123 } 124 return sequenceSet; 125 } 126 Set<? extends Event<?>> events = getEvents(); 127 Set<List<? extends Event<?>>> seqsShorter = generateSequences(length-1); 128 for( Event<?> event : events ) { 129 for( List<? extends Event<?>> seqShorter : seqsShorter ) { 130 Event<?> lastEvent = event; 131 if( getProbability(seqShorter, lastEvent)>0.0 ) { 132 List<Event<?>> subSeq = new ArrayList<Event<?>>(seqShorter); 133 subSeq.add(lastEvent); 134 sequenceSet.add(subSeq); 135 } 136 } 137 } 138 return sequenceSet; 108 139 } 109 140
Note: See TracChangeset
for help on using the changeset viewer.