Changeset 182 for trunk/EventBenchCore
- Timestamp:
- 09/14/11 18:51:16 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java
r176 r182 48 48 * </p> 49 49 */ 50 protected Trie<Event<?>> trie ;50 protected Trie<Event<?>> trie = null; 51 51 52 52 /** … … 79 79 * <p> 80 80 * Trains the model by generating a trie from which probabilities are 81 * calculated. 81 * calculated. The trie is newly generated based solely on the passed 82 * sequences. If an existing model should only be updated, use 83 * {@link #update(Collection)} instead. 82 84 * </p> 83 85 * … … 86 88 */ 87 89 public void train(Collection<List<Event<?>>> sequences) { 88 trie = new Trie<Event<?>>(); 89 90 trie = null; 91 update(sequences); 92 } 93 94 /** 95 * <p> 96 * Trains the model by updating the trie from which the probabilities are 97 * calculated. This function updates an existing trie. In case no trie 98 * exists yet, a new trie is generated and the function behaves like 99 * {@link #train(Collection)}. 100 * </p> 101 * 102 * @param sequences 103 * training data 104 */ 105 public void update(Collection<List<Event<?>>> sequences) { 106 if (trie == null) { 107 trie = new Trie<Event<?>>(); 108 } 90 109 for (List<Event<?>> sequence : sequences) { 91 110 List<Event<?>> currentSequence = new LinkedList<Event<?>>(sequence); // defensive … … 308 327 } 309 328 310 /* (non-Javadoc) 329 /* 330 * (non-Javadoc) 331 * 311 332 * @see de.ugoe.cs.eventbench.models.IStochasticProcess#getNumFOMStates() 312 333 */
Note: See TracChangeset
for help on using the changeset viewer.