- Timestamp:
- 04/14/11 11:12:06 (14 years ago)
- Location:
- trunk/EventBenchConsole/src/de/ugoe/cs/eventbench
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/EventGenerator.java
r1 r18 143 143 for (int ruleIndex = 0; ruleIndex < ruleElements.size() && !isMatch; ruleIndex++) { 144 144 Element currentRule = ruleElements.get(ruleIndex); 145 currentRuleName = currentRule.getAttributeValue("name"); 145 146 currentToken = new ReplayableEvent<WindowsMessage>(currentRuleName); 146 currentRuleName = currentRule.getAttributeValue("name");147 147 isMatch = true; 148 148 messageStorage = new HashMap<String, Object>(); -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDcalcEntropy.java
r1 r18 4 4 5 5 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 6 import de.ugoe.cs.eventbench.m arkov.MarkovModel;6 import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel; 7 7 import de.ugoe.cs.util.console.Command; 8 8 import de.ugoe.cs.util.console.Console; … … 25 25 } 26 26 27 MarkovModel model = null;27 FirstOrderMarkovModel model = null; 28 28 Object dataObject = GlobalDataContainer.getInstance().getData(modelname); 29 29 if( dataObject==null ) { 30 30 Console.println("Model " + modelname + "not found in storage."); 31 31 } 32 else if( !(dataObject instanceof MarkovModel) ) {33 Console.println("Object " + modelname + " is not a markov model!");32 else if( !(dataObject instanceof FirstOrderMarkovModel) ) { 33 Console.println("Object " + modelname + " is not a first-order Markov model!"); 34 34 } else { 35 model = ( MarkovModel) dataObject;35 model = (FirstOrderMarkovModel) dataObject; 36 36 double entropy = model.calcEntropy(); 37 37 if( Double.isNaN(entropy) ) { -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDgenerateRandomReplay.java
r1 r18 8 8 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 9 9 import de.ugoe.cs.eventbench.data.ReplayableEvent; 10 import de.ugoe.cs.eventbench.m arkov.MarkovModel;10 import de.ugoe.cs.eventbench.models.IStochasticProcess; 11 11 import de.ugoe.cs.util.console.Command; 12 12 import de.ugoe.cs.util.console.Console; … … 36 36 } 37 37 38 MarkovModelmodel = null;38 IStochasticProcess model = null; 39 39 Object dataObject = GlobalDataContainer.getInstance().getData(modelname); 40 40 if( dataObject==null ) { 41 41 Console.println("Model " + modelname + " not found in storage."); 42 42 } 43 else if( !(dataObject instanceof MarkovModel) ) {43 else if( !(dataObject instanceof IStochasticProcess) ) { 44 44 Console.println("Object " + modelname + " not of type MarkovModel!"); 45 45 } else { 46 model = ( MarkovModel) dataObject;46 model = (IStochasticProcess) dataObject; 47 47 List<List<ReplayableEvent<?>>> sequences = new LinkedList<List<ReplayableEvent<?>>>(); 48 48 try { -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDprintRandomSession.java
r4 r18 6 6 import de.ugoe.cs.eventbench.data.Event; 7 7 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 8 import de.ugoe.cs.eventbench.m arkov.MarkovModel;8 import de.ugoe.cs.eventbench.models.IStochasticProcess; 9 9 import de.ugoe.cs.util.console.Command; 10 10 import de.ugoe.cs.util.console.Console; … … 27 27 } 28 28 29 MarkovModelmodel = null;29 IStochasticProcess model = null; 30 30 Object dataObject = GlobalDataContainer.getInstance().getData(modelname); 31 31 if( dataObject==null ) { 32 32 Console.println("Model " + modelname + " not found in storage."); 33 33 } 34 else if( !(dataObject instanceof MarkovModel) ) {34 else if( !(dataObject instanceof IStochasticProcess) ) { 35 35 Console.println("Object " + modelname + " not of type MarkovModel!"); 36 36 } else { 37 model = ( MarkovModel) dataObject;37 model = (IStochasticProcess) dataObject; 38 38 for( Event<?> event : model.randomSequence() ) { 39 39 Console.println(event.toString()); -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowMarkovModel.java
r1 r18 12 12 13 13 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 14 import de.ugoe.cs.eventbench.m arkov.MarkovModel;15 import de.ugoe.cs.eventbench.m arkov.MarkovModel.MarkovEdge;14 import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel; 15 import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel.MarkovEdge; 16 16 import de.ugoe.cs.util.console.Command; 17 17 import de.ugoe.cs.util.console.Console; … … 47 47 Console.printerrln("No model with name " + modelname + "found"); 48 48 } else { 49 MarkovModel mm = (MarkovModel) dataObject;49 FirstOrderMarkovModel mm = (FirstOrderMarkovModel) dataObject; 50 50 51 51 Graph<String, MarkovEdge> graph = mm.getGraph(); … … 57 57 vv.setPreferredSize(new Dimension(1100,850)); //Sets the viewing area size 58 58 59 60 59 if( showNodeNames ) { 61 60 final Rectangle rect = new Rectangle(240, 20); … … 72 71 } 73 72 74 75 vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<MarkovModel.MarkovEdge>()); 73 vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<MarkovEdge>()); 76 74 77 75 JFrame frame = new JFrame("Markov Model"); … … 82 80 } 83 81 } 84 85 86 82 } -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainMarkovModel.java
r1 r18 4 4 import java.security.InvalidParameterException; 5 5 import java.util.List; 6 import java.util.Random; 6 7 7 8 import de.ugoe.cs.eventbench.data.Event; 8 9 import de.ugoe.cs.eventbench.data.GlobalDataContainer; 9 import de.ugoe.cs.eventbench.markov.MarkovModel; 10 import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel; 11 import de.ugoe.cs.eventbench.models.HighOrderMarkovModel; 10 12 import de.ugoe.cs.util.console.Command; 11 13 import de.ugoe.cs.util.console.Console; … … 15 17 @Override 16 18 public void help() { 17 Console.println("Usage: trainMarkovModel <modelName> ");19 Console.println("Usage: trainMarkovModel <modelName> {<order>}"); 18 20 } 19 21 … … 22 24 public void run(List<Object> parameters) { 23 25 String modelname; 26 int order = 1; 24 27 try { 25 28 modelname = (String) parameters.get(0); 29 if( parameters.size()==2 ) { 30 order = Integer.parseInt((String) parameters.get(0)); 31 } 26 32 } catch (Exception e) { 27 33 throw new InvalidParameterException(); … … 35 41 if( sequences.size()>0 ) { 36 42 if( sequences.get(0).get(0) instanceof Event ) { 37 MarkovModel model = new MarkovModel(); 43 HighOrderMarkovModel model; 44 if( order==1 ) { 45 model = new FirstOrderMarkovModel(new Random()); 46 } else { 47 model = new HighOrderMarkovModel(order, new Random()); 48 } 38 49 model.train(sequences); 39 50 if( GlobalDataContainer.getInstance().addData(modelname, model) ) { -
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDtrainPPM.java
r15 r18 41 41 if( GlobalDataContainer.getInstance().addData(modelname, model) ) { 42 42 Console.traceln("Old model overwritten"); 43 } 44 // TODO TMP!! 45 Console.traceln(model.randomSequence().toString()); 46 43 } 47 44 } else { 48 45 Console.traceln("Illegal use of \"sequences\" parameter in the GlobalDataContainer.");
Note: See TracChangeset
for help on using the changeset viewer.