Terrier IR Platform
1.1.1

uk.ac.gla.terrier.matching.models.basicmodel
Class BasicModel

java.lang.Object
  extended by uk.ac.gla.terrier.matching.models.basicmodel.BasicModel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
B, BM, Br, IF, In, In_exp, P

public abstract class BasicModel
extends java.lang.Object
implements java.io.Serializable

This class provides a contract for implementing the basic models for randomness in the DFR framework, for use with the DFRWeightingModel class. This is referred to as the component -log(prob1) in the DFR framework.

Version:
$Revision: 1.11 $
Author:
Ben He
See Also:
DFRWeightingModel, Serialized Form

Constructor Summary
BasicModel()
          A default constructor that initialises the idf i attribute
 
Method Summary
abstract  java.lang.String getInfo()
          Returns the name of the model.
abstract  double score(double tf, double documentFrequency, double termFrequency, double keyFrequency)
          This method provides the contract for implementing weighting models.
 void setNumberOfDocuments(double numOfDocs)
          Sets the number of documents in the collection.
 void setNumberOfTokens(double numTokens)
          Set the number of tokens in the collection.
 double stirlingPower(double n, double m)
          This method provides the contract for implementing the Stirling formula for the power series.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicModel

public BasicModel()
A default constructor that initialises the idf i attribute

Method Detail

getInfo

public abstract java.lang.String getInfo()
Returns the name of the model.

Returns:
java.lang.String

setNumberOfDocuments

public void setNumberOfDocuments(double numOfDocs)
Sets the number of documents in the collection.

Parameters:
numOfDocs - the number of documents in the collection.

setNumberOfTokens

public void setNumberOfTokens(double numTokens)
Set the number of tokens in the collection.

Parameters:
numTokens - double The number of tokens in the collection.

score

public abstract double score(double tf,
                             double documentFrequency,
                             double termFrequency,
                             double keyFrequency)
This method provides the contract for implementing weighting models.

Parameters:
tf - The term frequency in the document
documentFrequency - The document frequency of the term
termFrequency - The term frequency of the term in the collection
keyFrequency - The normalised query term frequency.
Returns:
the score returned by the implemented weighting model.

stirlingPower

public double stirlingPower(double n,
                            double m)
This method provides the contract for implementing the Stirling formula for the power series.

Parameters:
n - The parameter of the Stirling formula.
m - The parameter of the Stirling formula.
Returns:
the approximation of the power series

Terrier IR Platform
1.1.1

Terrier Information Retrieval Platform 1.1.1. Copyright 2004-2007 University of Glasgow