|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.combi.CombinationStrategy
public abstract class CombinationStrategy
A combination strategy combines sequential classifications. Instances of
this class are not thread-safe. Subclasses must also provide a constructor
that accepts a Set
of valid class names as single argument;
otherwise they cannot be loaded via reflection.
Field Summary | |
---|---|
static String |
CONFIG_COMBINATION
Configuration key specifying the combination strategy to use. |
Constructor Summary | |
---|---|
CombinationStrategy(Set<String> theClasses)
Creates a new instance. |
Method Summary | |
---|---|
abstract Set<String>[] |
activeClasses()
Builds a set array of class names (Strings) to pass to each classifier to consider for the next decision. |
abstract Set<String>[] |
allClasses()
Returns an array of immutable sets of all classes (Strings) that can possible occur during classification for each classifier. |
static CombinationStrategy |
createStrategy(Set<String> classNames)
Factory method that delegates to createStrategy(Set, TiesConfiguration) using the
standard configuration. |
static CombinationStrategy |
createStrategy(Set<String> classNames,
TiesConfiguration config)
Factory method that creates a combination strategy based on the CONFIG_COMBINATION key in the provided configuration. |
protected Set |
getValidClasses()
Returns the set of valid class names. |
boolean |
reset()
Resets the state() of this instance to the initial value
CombinationState.OUTSIDE . |
protected boolean |
resetHook()
Hook called by the reset() method to query whether the last
extraction should be discarded, analogously to
CombinationState.isDiscardPreceding() . |
CombinationState |
state()
The current state (state of the last item). |
String |
toString()
Returns a string representation of this object. |
abstract String[] |
translateCurrentState(CombinationState currentState)
Translates an expected class to a class name to feed to the classifiers in training mode. |
abstract CombinationState |
translateResult(PredictionDistribution[] predictions)
Translates the classes predicted by the classifiers in a decision for the caller. |
void |
updateState(CombinationState newState)
Updates the current state (the class of the last item). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CONFIG_COMBINATION
Constructor Detail |
---|
public CombinationStrategy(Set<String> theClasses)
theClasses
- a set of valid class names (String)Method Detail |
---|
public static CombinationStrategy createStrategy(Set<String> classNames) throws IllegalArgumentException, ProcessingException
createStrategy(Set, TiesConfiguration)
using the
standard configuration.
classNames
- a set of valid class names (String)
IllegalArgumentException
- if the value of the
CONFIG_COMBINATION
key is missing or invalid
ProcessingException
- if an error occurred while creating the
strategypublic static CombinationStrategy createStrategy(Set<String> classNames, TiesConfiguration config) throws IllegalArgumentException, ProcessingException
CONFIG_COMBINATION
key in the provided configuration.
Currently supported values:
"BE" for BeginEndStrategy
,
"BIA" for BeginAfterStrategy
,
"BIE" for OpenCloseStrategy
,
"IOB1" for InsideOutsideStrategy
with
InsideOutsideStrategy.isBStartingAll()
set to false
,
"IOB2" for InsideOutsideStrategy
with
InsideOutsideStrategy.isBStartingAll()
set to true
;
"Triv" for TrivialStrategy
.
Otherwise the value must be the qualified name of a
CombinationStrategy subclass accepting a Set
(of valid class
names) as single argument.
classNames
- a set of valid class names (String)config
- the configuration to use
IllegalArgumentException
- if the value of the
CONFIG_COMBINATION
key is missing or invalid
ProcessingException
- if an error occurred while creating the
strategypublic abstract Set<String>[] activeClasses()
allClasses()
.
public abstract Set<String>[] allClasses()
public abstract String[] translateCurrentState(CombinationState currentState) throws IllegalArgumentException
translateResult(PredictionDistribution[])
.
The return value can be feed to the classifiers for training it.
currentState
- the current state
IllegalArgumentException
- if the specified argument is invalid
(non-empty string that is not in the set of valid classes, or empty
string when null
was given in the preceding call)public abstract CombinationState translateResult(PredictionDistribution[] predictions) throws IllegalArgumentException
predictions
- array containing the prediction distributions of
all classifier
IllegalArgumentException
- if the specified argument was invalid
(not in the set of currently active classes
protected Set getValidClasses()
public final boolean reset()
state()
of this instance to the initial value
CombinationState.OUTSIDE
. Also checks whether the last extraction
should be discarded, analogously to
CombinationState.isDiscardPreceding()
. The default behavior
is to always return false
, but subclasses can modify
this by overwriting the resetHook()
method.
true
iff the last extraction should be discardedprotected boolean resetHook()
reset()
method to query whether the last
extraction should be discarded, analogously to
CombinationState.isDiscardPreceding()
.
public CombinationState state()
public String toString()
toString
in class Object
public void updateState(CombinationState newState) throws IllegalArgumentException
translateResult(PredictionDistribution[])
) and/or training
(translateCurrentState(CombinationState)
) an item.
newState
- the state of the last item
IllegalArgumentException
- if the
type of the argument is invalid
(not in the set of valid classes or
null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |