package de.ugoe.cs.eventbench.efg; import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Random; import de.ugoe.cs.eventbench.commands.CMDupdateModel; import de.ugoe.cs.eventbench.data.Event; import de.ugoe.cs.eventbench.efg.data.EFGEvent; import de.ugoe.cs.eventbench.models.DeterministicFiniteAutomaton; import de.ugoe.cs.eventbench.models.FirstOrderMarkovModel; import edu.umd.cs.guitar.model.GUITARConstants; import edu.umd.cs.guitar.model.IO; import edu.umd.cs.guitar.model.data.EFG; import edu.umd.cs.guitar.model.data.EventGraphType; import edu.umd.cs.guitar.model.data.EventType; /** *
* Provides functionality to generates models defined in the package * de.ugoe.cs.eventbench.models from EFGs. *
* * @author Steffen Herbold * @version 1.0 */ public class EFGModelGenerator { /** ** Generates a {@link FirstOrderMarkovModel} from an EFG. In the generated * model, all following events are equally possible, i.e., the model is * equal to a {@link DeterministicFiniteAutomaton}. However, through further * training (e.g., {@link CMDupdateModel}) this can be changed. *
* * @param efgFileName * name of the EFG file * @return model generated from the EFG */ public FirstOrderMarkovModel efgToFirstOrderMarkovModel(String efgFileName) { EFG efg = (EFG) IO.readObjFromFile(efgFileName, EFG.class); Collection* Generates a {@link DeterministicFiniteAutomaton} from an EFG. *
* * @param efgFileName * name of the EFG file * @return model generated from the EFG */ public DeterministicFiniteAutomaton efgToDeterministicFiniteAutomaton( String efgFileName) { EFG efg = (EFG) IO.readObjFromFile(efgFileName, EFG.class); Collection* Extracts the graph structure from the EFG. The result is a set of * sequences, where each sequence has length two and represents an edge in * the EFG. *
* * @param efg * EFG for which the edge sequence set is generated * @return edge sequence set */ private Collection* Extracts creates {@link EFGEvent} for every event contained in the EFG. *
* * @param efg * EFG for which the events are created * @return list of events */ private List