System documentation of the GNU Image-Finding Tool

Public Member Functions | Protected Attributes | Friends | List of all members
CWeightingFunction Class Reference

a universally usable class for weighting. More...

#include <CWeightingFunction.h>

Inheritance diagram for CWeightingFunction:
CWFBestFullyWeighted CWFBestProbabilistic CWFBinaryTerm CWFClassicalIDF CWFCoordinationLevel CWFProbability CWFStandardTF

Public Member Functions

double getQueryFactor () const
 The query factor contains all informatio which depends only on the query. More...
 
virtual void preCalculate ()
 Calculate the QueryFactor.
 
 CWeightingFunction (const CAcInvertedFile *inAccessor=0, CQueryNormalizer *inQueryNormalizer=0, CQueryNormalizer *inThisNormalizer=0)
 Constructor: More...
 
void setAccessor (const CAcInvertedFile *)
 Set the accessor (should not be needed) More...
 
void setNormalizers (CQueryNormalizer *inQueryNormalizer, CQueryNormalizer *inThisNormalizer)
 Set the query normalizer (should not be needed);. More...
 
void setID (TID)
 Set the ID of this feature. More...
 
TID getID () const
 get the ID of this feature More...
 
void setRelevanceSum (double inPositiveRelevanceSum, double inNegativeRelevanceSum)
 Setting the relevance sum, that is the sum of the absolute values of all relevance levels of all documents of the query. More...
 
virtual void addQueryFeature (double inRelevanceLevel, const CDocumentFrequencyElement &inQueryFeature)
 Add a feature. More...
 
virtual double getTermFrequency () const
 Giving a pseudo term frequency for normalization. More...
 
virtual double subApply (const double inDocumentFrequency, const double inNormalizingFactor) const
 Apply this on a document frequency. More...
 
virtual double apply (const CDocumentFrequencyElement &inResultFeature) const
 Preparing the right parameters for subApply: Apply this on another feature. More...
 
double applyOnThis () const
 Preparing the right parameters for subApply: Apply this on itself. More...
 
virtual CWeightingFunctionconstructNew (TID inID) const
 For the "prototype pattern": Kinda virtual copy constructor: Gamma/Helm/Johnson/Vlissides p. More...
 
virtual CWeightingFunctionclone () const
 For the "prototype pattern": Kinda virtual copy constructor: Gamma/Helm/Johnson/Vlissides p. More...
 
virtual ~CWeightingFunction ()
 This virtual destructor is here inorder to call the (inherited) default constructors.
 

Protected Attributes

double mPositiveRelevanceSum
 This value depends on all the elements of the query, which have a positive user-assigned relevance. More...
 
double mNegativeRelevanceSum
 This value depends on all the elements of the query, which have a negative user-assigned relevance. More...
 
double mPositiveTermFrequency
 
double mNegativeTermFrequency
 
int mFeatureDescription
 At present the feature description is a simple integer which expresses if the feature is a histogram feature or not and if it is a texture feature or not. More...
 
TID mID
 
const CAcInvertedFilemAccessor
 The accessor for the file on which the query is performed.
 
CQueryNormalizermQueryNormalizer
 FIXME THERE IS A GOOD DESCRIPTION MISSING FOR THE NEXT TWO VARIABLES.
 
CQueryNormalizermThisNormalizer
 A normalizer for apply on self.
 
double mQueryFactor
 The query usually will separate into a part which is equal for all the query and a part which is to be calculated for each document. More...
 
double mDocumentFactor
 

Friends

class CSortByDFTimesLogICF_WF
 

Detailed Description

a universally usable class for weighting.

The rationale is, that we want to implement very flexible feature weighting, so flexible that it does not necessarily have anything to do with the initial concept of feature weighting.

The scenario: We have query/feedback from the user. That is: We have a list of images with either positive or negative relevance for the user. Each of these images contains a list of features.

Now we want to combine the different features. What we usually need to know is: how many images where in the positive feedback, and how many images where in the negative feedback.

Constructor & Destructor Documentation

§ CWeightingFunction()

CWeightingFunction::CWeightingFunction ( const CAcInvertedFile inAccessor = 0,
CQueryNormalizer inQueryNormalizer = 0,
CQueryNormalizer inThisNormalizer = 0 
)

Constructor:

Parameters
inAccessorthe accessor containing this \ (for getting information about single documents)
inQueryNormalizerFIXME
inThisNormalizerFIXME

Member Function Documentation

§ addQueryFeature()

virtual void CWeightingFunction::addQueryFeature ( double  inRelevanceLevel,
const CDocumentFrequencyElement inQueryFeature 
)
virtual

Add a feature.

A feature will be a document frequency element out of the feature file.

§ apply()

virtual double CWeightingFunction::apply ( const CDocumentFrequencyElement inResultFeature) const
virtual

Preparing the right parameters for subApply: Apply this on another feature.

Reimplemented in CWFBestFullyWeighted, CWFBestProbabilistic, and CWFStandardTF.

§ applyOnThis()

double CWeightingFunction::applyOnThis ( ) const

Preparing the right parameters for subApply: Apply this on itself.

§ clone()

virtual CWeightingFunction* CWeightingFunction::clone ( ) const
virtual

For the "prototype pattern": Kinda virtual copy constructor: Gamma/Helm/Johnson/Vlissides p.

107

This is a new version of constructNew which manages to live without the setID function

Reimplemented in CWFBestFullyWeighted, CWFClassicalIDF, CWFBestProbabilistic, CWFStandardTF, CWFBinaryTerm, CWFCoordinationLevel, and CWFProbability.

§ constructNew()

virtual CWeightingFunction* CWeightingFunction::constructNew ( TID  inID) const
virtual

For the "prototype pattern": Kinda virtual copy constructor: Gamma/Helm/Johnson/Vlissides p.

107

§ getID()

TID CWeightingFunction::getID ( ) const

get the ID of this feature

§ getQueryFactor()

double CWeightingFunction::getQueryFactor ( ) const

The query factor contains all informatio which depends only on the query.

(for efficiency)

§ getTermFrequency()

virtual double CWeightingFunction::getTermFrequency ( ) const
virtual

Giving a pseudo term frequency for normalization.

§ setAccessor()

void CWeightingFunction::setAccessor ( const CAcInvertedFile )

Set the accessor (should not be needed)

§ setID()

void CWeightingFunction::setID ( TID  )

Set the ID of this feature.

§ setNormalizers()

void CWeightingFunction::setNormalizers ( CQueryNormalizer inQueryNormalizer,
CQueryNormalizer inThisNormalizer 
)

Set the query normalizer (should not be needed);.

§ setRelevanceSum()

void CWeightingFunction::setRelevanceSum ( double  inPositiveRelevanceSum,
double  inNegativeRelevanceSum 
)

Setting the relevance sum, that is the sum of the absolute values of all relevance levels of all documents of the query.

for rocchio we need this sum to be once calculated for positive, once for negative feedback images

§ subApply()

virtual double CWeightingFunction::subApply ( const double  inDocumentFrequency,
const double  inNormalizingFactor 
) const
virtual

Member Data Documentation

§ mFeatureDescription

int CWeightingFunction::mFeatureDescription
protected

At present the feature description is a simple integer which expresses if the feature is a histogram feature or not and if it is a texture feature or not.

We probably will use more elaborate descriptions in the future.

§ mNegativeRelevanceSum

double CWeightingFunction::mNegativeRelevanceSum
protected

This value depends on all the elements of the query, which have a negative user-assigned relevance.

i.e. not necessarily only on the elements which contain this feature, so it has to be explicitly set using the function setRelevanceSum from the outside.

If relevance=+-1 then this is the number of negative images in the query

§ mPositiveRelevanceSum

double CWeightingFunction::mPositiveRelevanceSum
protected

This value depends on all the elements of the query, which have a positive user-assigned relevance.

i.e. not necessarily only on the elements which contain this feature, so it has to be explicitly set using the function setRelevanceSum from the outside.

If relevance=+-1 then this is the number of positive images in the query

§ mQueryFactor

double CWeightingFunction::mQueryFactor
protected

The query usually will separate into a part which is equal for all the query and a part which is to be calculated for each document.

The part which stays constant


The documentation for this class was generated from the following file:

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen