|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.matching.models.WeightingModel org.terrier.matching.models.DFRWeightingModel
public class DFRWeightingModel
This class implements a modular Divergence from Randomness weighting model. Components in the model are specified individually, with many implementations provided: org.terrier.matching.models.basicmodel; org.terrier.matching.models.aftereffect; and org.terrier.matching.models.normalisation. A class name for each component should be specific in parenthesis after DFRWeightingModel. Moreover, besides the basic model, the other two components can be either specified or disabled.
Examples:
PL2
PL2
Field Summary | |
---|---|
protected AfterEffect |
afterEffect
The applied model for after effect (aka. |
protected java.lang.String |
AFTEREFFECT_PREFIX
The prefix of the package of the first normalisation methods by after effect. |
protected BasicModel |
basicModel
The applied basic model for randomness. |
protected java.lang.String |
BASICMODEL_PREFIX
The prefix of the package of the basic models for randomness. |
protected boolean |
ENABLE_AFTEREFFECT
A boolean that indicates if the first normalisation by after effect is enabled. |
protected boolean |
ENABLE_NORMALISATION
A boolean that indicates if the frequency normalisation is enabled. |
protected static org.apache.log4j.Logger |
logger
|
protected Normalisation |
normalisation
The applied frequency normalisation method. |
protected java.lang.String |
NORMALISATION_PREFIX
The prefix of the package of the frequency normalisation methods. |
protected double |
parameter
The parameter of the frequency normalisation component. |
Fields inherited from class org.terrier.matching.models.WeightingModel |
---|
averageDocumentLength, c, documentFrequency, i, keyFrequency, numberOfDocuments, numberOfPointers, numberOfTokens, numberOfUniqueTerms, termFrequency |
Constructor Summary | |
---|---|
DFRWeightingModel(java.lang.String[] components)
The default constructor. |
Method Summary | |
---|---|
java.lang.String |
getInfo()
Returns the name of the model. |
double |
getParameter()
Return the parameter set by setParameter() |
protected void |
initialise(java.lang.String basicModelName,
java.lang.String afterEffectName,
java.lang.String normalisationName)
Initialise the components in the DFR model. |
protected void |
initialise(java.lang.String basicModelName,
java.lang.String afterEffectName,
java.lang.String normalisationName,
double _parameter)
Initialise the components in the DFR model. |
double |
score(double tf,
double docLength)
Compute a weight for a term in a document. |
double |
score(double tf,
double docLength,
double documentFrequency,
double termFrequency,
double queryTermWeight)
Compute a weight for a term in a document. |
void |
setCollectionStatistics(CollectionStatistics _cs)
Sets collection statistics |
void |
setEntryStatistics(EntryStatistics _es)
Sets entry statistics. |
void |
setParameter(double value)
Set the frequency normalisation parameter. |
Methods inherited from class org.terrier.matching.models.WeightingModel |
---|
clone, getOverflowed, prepare, score, setAverageDocumentLength, setDocumentFrequency, setKeyFrequency, setNumberOfDocuments, setNumberOfPointers, setNumberOfTokens, setNumberOfUniqueTerms, setRequest, setTermFrequency, stirlingPower |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger logger
protected BasicModel basicModel
protected AfterEffect afterEffect
protected Normalisation normalisation
protected final java.lang.String NORMALISATION_PREFIX
protected final java.lang.String BASICMODEL_PREFIX
protected final java.lang.String AFTEREFFECT_PREFIX
protected double parameter
protected boolean ENABLE_NORMALISATION
protected boolean ENABLE_AFTEREFFECT
Constructor Detail |
---|
public DFRWeightingModel(java.lang.String[] components)
components
- Corresponds to the names of the 3 DFR weighting models component
names, as passed to initialise().Method Detail |
---|
protected void initialise(java.lang.String basicModelName, java.lang.String afterEffectName, java.lang.String normalisationName)
basicModelName
- The name of the applied basic model for randomness. This
component must be specified and can NOT be an empty string.afterEffectName
- The name of the applied first normalisation by after
effect. An empty string to disable this component.normalisationName
- The name of the applied frequency normalisation
component. An empty string to disable this component.protected void initialise(java.lang.String basicModelName, java.lang.String afterEffectName, java.lang.String normalisationName, double _parameter)
basicModelName
- The name of the applied basic model for randomness. This
component must be specified and can NOT be an empty string.afterEffectName
- The name of the applied first normalisation by after
effect. An empty string to disable this component.normalisationName
- The name of the applied frequency normalisation
component. An empty string to disable this component._parameter
- The applied parameter value of the frequency normalisation.public void setParameter(double value)
setParameter
in interface Model
setParameter
in class WeightingModel
value
- The given parameter value.public double getParameter()
getParameter
in interface Model
getParameter
in class WeightingModel
public final java.lang.String getInfo()
getInfo
in interface Model
getInfo
in class WeightingModel
public final double score(double tf, double docLength)
score
in class WeightingModel
tf
- The term frequency in the documentdocLength
- the document's length
public final double score(double tf, double docLength, double documentFrequency, double termFrequency, double queryTermWeight)
score
in class WeightingModel
tf
- The term frequency in the documentdocLength
- the document's lengthdocumentFrequency
- The document frequency of the termtermFrequency
- the term frequency in the collectionqueryTermWeight
- the term frequency in the query
public void setCollectionStatistics(CollectionStatistics _cs)
WeightingModel
setCollectionStatistics
in class WeightingModel
public void setEntryStatistics(EntryStatistics _es)
WeightingModel
setEntryStatistics
in class WeightingModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |