Changeset 2026 for trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/TrieBasedModel.java
- Timestamp:
- 07/23/15 13:43:38 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/TrieBasedModel.java
r1996 r2026 147 147 @Override 148 148 public List<Event> randomSequence() { 149 return randomSequence(Integer.MAX_VALUE, true );149 return randomSequence(Integer.MAX_VALUE, true, 100); 150 150 } 151 151 … … 156 156 */ 157 157 @Override 158 public List<Event> randomSequence(int maxLength, boolean validEnd ) {158 public List<Event> randomSequence(int maxLength, boolean validEnd, long maxIter) { 159 159 List<Event> sequence = new LinkedList<Event>(); 160 int attempts = 0; 160 161 if (trie != null) { 161 162 boolean endFound = false; 162 while (!endFound) { // outer loop for length checking 163 sequence = new LinkedList<Event>(); 163 while (!endFound && attempts <= maxIter) { // outer loop for length checking 164 164 IncompleteMemory<Event> context = new IncompleteMemory<Event>(trieOrder - 1); 165 165 context.add(Event.STARTEVENT); … … 186 186 } 187 187 } 188 if (!endFound) { 189 sequence = new LinkedList<Event>(); 190 } 191 attempts++; 188 192 } 189 193 } … … 398 402 List<Event> context = new LinkedList<Event>(); 399 403 for (Event event : sequence) { 400 odds += Math.log(getProbability(context, event) +1);404 odds += Math.log(getProbability(context, event) + 1); 401 405 context.add(event); 402 406 }
Note: See TracChangeset
for help on using the changeset viewer.