be.unamur.inference.ngram
Class Bigram<T>
java.lang.Object
be.unamur.inference.ngram.Bigram<T>
- Type Parameters:
T - The object type passed to the ObjectKeyGenerator provided at
construction time of Bigram object.
public class Bigram<T>
- extends Object
This class implements methods to generate a UsageModel from a set of
traces. The model is generated using the bigram method, meaning that the
probability for each next state only depends on the previous state. Usage of
the class should be:
- Creation of the object by providing a key generator used to generate the
key of each trace's element
- Adding traces to infer the model using addTrace(List<T>) method.
- Getting he
UsageModel using getModel() method.
- Author:
- Xavier Devroey - xavier.devroey@unamur.be
|
Method Summary |
void |
addTrace(Iterator<T> trace)
Add a trace to the bigram. |
be.unamur.transitionsystem.usagemodel.UsageModel |
getModel()
Return the model inferred from the given traces. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
START_STATE_ID
public static final String START_STATE_ID
- See Also:
- Constant Field Values
END_STATE_ID
public static final String END_STATE_ID
- See Also:
- Constant Field Values
Bigram
public Bigram(ObjectKeyGenerator<T> keyGen)
- Create a new
Bigram object.
- Parameters:
keyGen - The key generator used to generate the key corresponding to
each trace entry.
addTrace
public void addTrace(Iterator<T> trace)
- Add a trace to the bigram. This trace is used to enrich the model.
- Parameters:
trace - The trace to add.
getModel
public be.unamur.transitionsystem.usagemodel.UsageModel getModel()
- Return the model inferred from the given traces. This method should be
called once all the traces have been added to the
Bigram
instance.
- Returns:
- The inferred model.
Copyright © 2014 PReCISE, University of Namur. All rights reserved.