|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.illinois.cs.cogcomp.lbj.coref.decoders.DecoderWithOptions<ST>
edu.illinois.cs.cogcomp.lbj.coref.decoders.ChainSolutionDecoder<ChainSolution<Mention>,Mention,CExample>
edu.illinois.cs.cogcomp.lbj.coref.decoders.CorefDecoder
edu.illinois.cs.cogcomp.lbj.coref.decoders.ScoredCorefDecoder
public abstract class ScoredCorefDecoder
Base class for decoders which depend on a score from a learned classifier.
For compatibility with code that loads dynamically (such as the GUI)
subclasses should provide at least two constructors:
A constructor that takes just a LinearThresholdUnit
and a constructor that takes a LinearThresholdUnit
and a Classifier
(in that order).
Field Summary | |
---|---|
private java.util.List<java.lang.Double> |
m_allScores
The collection of all scores |
protected boolean |
m_cacheScores
Determines whether scores should be cached. |
protected boolean |
m_recordAllScores
Determines whether all uncached (or cache missed) calls of the getTrueScore method record the score. |
private java.util.Map<CExample,java.lang.Double> |
m_scoreCache
The scores cache |
protected LBJ2.learn.LinearThresholdUnit |
m_scorer
The scoring classifier. |
private static long |
serialVersionUID
|
Fields inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.CorefDecoder |
---|
m_classifier |
Fields inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.DecoderWithOptions |
---|
m_options, m_train |
Constructor Summary | |
---|---|
ScoredCorefDecoder(LBJ2.learn.LinearThresholdUnit c)
Constructs a decoder whose decisions will depend on the scores of a linear threshold unit, which will also be used to make coreference decisions via its discreteValue method. |
|
ScoredCorefDecoder(LBJ2.learn.LinearThresholdUnit scorer,
LBJ2.classify.Classifier decider)
Constructor for use when the scoring classifier is not sufficient to decide whether links should be made, such as when inference is being applied. |
Method Summary | |
---|---|
protected java.util.List<java.lang.String> |
getEdgeLabels(CExample ex)
If the scoring classifier is a SparsePerceptron, generate a list of labels, each indicating the name and weight of an active feature. |
protected java.util.Map<java.lang.String,java.lang.Double> |
getFeatureWeights(LBJ2.learn.SparsePerceptron c)
Gets all the known features of the given classifier and their weights. |
protected java.util.Map<java.lang.String,java.lang.Double> |
getMinimumPartsOfCompounds(java.util.Map<java.lang.String,java.lang.Double> map)
Gets the smaller feature weight for each conjunction of features in the given feature-weight map. |
LBJ2.learn.LinearThresholdUnit |
getScorer()
Gets the scoring classifier. |
java.lang.String |
getStatsString()
Get statistics encoded as a string. |
protected java.util.Map<java.lang.String,java.lang.Double> |
getSumsOfParts(java.util.Map<java.lang.String,java.lang.Double> feats,
java.util.Map<java.lang.String,java.lang.Double> mins)
Gets the total of all the weight each feature contributes. |
protected java.util.Map<java.lang.String,java.lang.Double> |
getTotalsOfPartsOfCompounds(java.util.Map<java.lang.String,java.lang.Double> map)
Gets, for each feature, the total of all the weights of each conjunction that feature occurs in. |
double |
getTrueScore(CExample ex)
Gets the score for the true prediction of the scoring classifier applied to the example. |
protected boolean |
predictedCoreferential(CExample ex)
Determines whether an example is coreferential. |
private void |
recordScore(double score)
Record a score for statistics purposes. |
void |
setScorer(LBJ2.learn.LinearThresholdUnit scorer)
Sets the scoring classifier. |
protected void |
setup()
Initializes members. |
Methods inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.CorefDecoder |
---|
getClassifier, setClassifier |
Methods inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.ChainSolutionDecoder |
---|
decode |
Methods inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.DecoderWithOptions |
---|
getBooleanOption, getOption, getRealOption, processOption, setOption, setOption, setOption, setTrain |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
protected LBJ2.learn.LinearThresholdUnit m_scorer
protected boolean m_cacheScores
private java.util.Map<CExample,java.lang.Double> m_scoreCache
protected boolean m_recordAllScores
private java.util.List<java.lang.Double> m_allScores
Constructor Detail |
---|
public ScoredCorefDecoder(LBJ2.learn.LinearThresholdUnit c)
discreteValue
method.
c
- A coreference classifier which takes CExample
s
and indicates coreference by returning "true" or "false", and also
produces a score.public ScoredCorefDecoder(LBJ2.learn.LinearThresholdUnit scorer, LBJ2.classify.Classifier decider)
scorer
and decider
must return "true" for
predictedCoreferential(CExample)
to return true.
scorer
- Determines the score or confidence.
Takes CExample
s and returns a score.decider
- Final arbiter of linking decisions.
Takes CExample
s and returns "true" or "false".Method Detail |
---|
protected void setup()
public LBJ2.learn.LinearThresholdUnit getScorer()
public void setScorer(LBJ2.learn.LinearThresholdUnit scorer)
scorer
. Otherwise, only the scorer will be updated.
scorer
- The new scoring classifier.protected boolean predictedCoreferential(CExample ex)
predictedCoreferential
in class CorefDecoder
ex
- The example to be classified as coreferential or not.
public double getTrueScore(CExample ex)
ex
- The example to score.
public java.lang.String getStatsString()
getStatsString
in class ChainSolutionDecoder<ChainSolution<Mention>,Mention,CExample>
private void recordScore(double score)
score
- A confidence score.protected java.util.List<java.lang.String> getEdgeLabels(CExample ex)
ex
- The example to be processed by the scorer.
protected java.util.Map<java.lang.String,java.lang.Double> getFeatureWeights(LBJ2.learn.SparsePerceptron c)
c
- The classifier to examine.
c
to their
weights.protected java.util.Map<java.lang.String,java.lang.Double> getMinimumPartsOfCompounds(java.util.Map<java.lang.String,java.lang.Double> map)
map
- A map from features to weights.
Some of the features may be conjunctions of multiple features.
f
that is part of a conjunction
to the smallest weight of the features of which f
is part.protected java.util.Map<java.lang.String,java.lang.Double> getTotalsOfPartsOfCompounds(java.util.Map<java.lang.String,java.lang.Double> map)
map
- A map from features to weights.
f
to the total of all the weights
of each conjunction that f
occurs in.protected java.util.Map<java.lang.String,java.lang.Double> getSumsOfParts(java.util.Map<java.lang.String,java.lang.Double> feats, java.util.Map<java.lang.String,java.lang.Double> mins)
feats
- A map from features to weights.mins
- A map from features to the minimum weight.
f
to the total weight f
contributes.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |