I
- input symbol typeD
- output domain typeSP
- state property typeTP
- transition property typeM
- model typepublic abstract class AbstractBlueFringeRPNI<I,D,SP,TP,M> extends Object implements PassiveLearningAlgorithm<M,I,D>
Unlike most descriptions of RPNI in the literature, the Blue Fringe version of RPNI does not consider all possible pairs of states for merging, but instead maintains a monotonically growing set of "red states", the immediate non-red successors of which are called blue states. In each iteration of the main loop, an attempt is made to merge a blue state into any red state. If this is impossible, the blue state is promoted, meaning it is converted into a red state itself. The procedure terminates when all states are red.
A blue fringe version of RPNI is described in the book "Grammatical Inference" by Colin de la Higuera.
PassiveLearningAlgorithm.PassiveAcceptorLearner<M extends net.automatalib.automata.fsa.FiniteStateAcceptor<?,I>,I>, PassiveLearningAlgorithm.PassiveDFALearner<I>, PassiveLearningAlgorithm.PassiveMealyLearner<I,O>, PassiveLearningAlgorithm.PassiveNFALearner<I>
Modifier and Type | Field and Description |
---|---|
protected net.automatalib.words.Alphabet<I> |
alphabet |
protected int |
alphabetSize |
protected boolean |
deterministic |
protected ProcessingOrder |
order |
protected boolean |
parallel |
Constructor and Description |
---|
AbstractBlueFringeRPNI(net.automatalib.words.Alphabet<I> alphabet)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
M |
computeModel() |
protected boolean |
decideOnValidMerge(RedBlueMerge<SP,TP,BlueFringePTAState<SP,TP>> merge)
Implementing the method allows subclasses to decide (and possible reject) valid merges.
|
protected abstract void |
initializePTA(BlueFringePTA<SP,TP> pta)
Initializes an empty PTA with sample data.
|
protected abstract M |
ptaToModel(BlueFringePTA<SP,TP> pta)
Transforms the final PTA into a model.
|
void |
setDeterministic(boolean deterministic)
Sets whether the outcome of the algorithm is required to be deterministic (i.e., subsequent calls of
computeModel() on the same input data will perform the same merges and return the same result). |
void |
setParallel(boolean parallel)
Sets whether attempts to merge a blue into a red state are conducted in parallel.
|
protected RedBlueMerge<SP,TP,BlueFringePTAState<SP,TP>> |
tryMerge(BlueFringePTA<SP,TP> pta,
BlueFringePTAState<SP,TP> qr,
BlueFringePTAState<SP,TP> qb)
Attempts to merge a blue state into a red state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addSample, addSample, addSamples, addSamples, addSamples, addSamples
protected final net.automatalib.words.Alphabet<I> alphabet
protected final int alphabetSize
@Nonnull protected final ProcessingOrder order
protected boolean parallel
protected boolean deterministic
public AbstractBlueFringeRPNI(net.automatalib.words.Alphabet<I> alphabet)
alphabet
- the alphabetpublic void setParallel(boolean parallel)
Note that setting this to true
does not inhibit the possibility of deterministic algorithm runs (see
setDeterministic(boolean)
).
parallel
- whether to parallelize the process of finding a possible mergepublic void setDeterministic(boolean deterministic)
computeModel()
on the same input data will perform the same merges and return the same result).
Note that if parallel execution is disabled (see setParallel(boolean)
), the algorithm will most likely
(but is not required to) behave deterministically even with this set to false
. However, if
parallelization is enabled, results of subsequent invocations will most likely differ with this parameter set to
false
.
deterministic
- whether to enforce deterministic algorithm behaviorpublic M computeModel()
computeModel
in interface PassiveLearningAlgorithm<M,I,D>
protected abstract void initializePTA(BlueFringePTA<SP,TP> pta)
pta
- the PTA to initializeprotected RedBlueMerge<SP,TP,BlueFringePTAState<SP,TP>> tryMerge(BlueFringePTA<SP,TP> pta, BlueFringePTAState<SP,TP> qr, BlueFringePTAState<SP,TP> qb)
pta
- the blue fringe PTAqr
- the red state (i.e., the merge target)qb
- the blue state (i.e., the merge source)RedBlueMerge
object representing a possible merge of qb
into qr
, or
null
if the merge is impossibleprotected abstract M ptaToModel(BlueFringePTA<SP,TP> pta)
pta
- the final PTAprotected boolean decideOnValidMerge(RedBlueMerge<SP,TP,BlueFringePTAState<SP,TP>> merge)
merge
- the prosed (valid) mergetrue
if the suggested merge should be performed, false
otherwiseCopyright © 2018. All rights reserved.