System documentation of the GNU Image-Finding Tool

Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CQInvertedFile Class Reference

The Query manager for Queries on inverted Files. More...

#include <CQInvertedFile.h>

Inheritance diagram for CQInvertedFile:
CQuery CMagic

Classes

struct  parameterPruningType
 Parameters for scoreboard pruning. More...
 

Public Member Functions

void finishInit ()
 finish the initialisation phase make the weighting function know who its normalizers are
 
 CQInvertedFile (CAccessorAdminCollection &inAccessorAdminCollection, CAlgorithm &inAlgorithm)
 New constructor, taking as parameter the algorithm structure, which contains all the algorithm configuration. More...
 
 ~CQInvertedFile ()
 destructor More...
 
virtual bool setAlgorithm (CAlgorithm &inAlgorithm)
 set the Algorithm. More...
 
virtual CIDRelevanceLevelPairListfastQuery (const CXMLElement &inQuery, int inNumberOfInterestingImages, double inDifferenceToBest)
 a query which returns ID/RelevanceLevel pairs instead of instead of URL/RelevanceLevel pairs; this is faster for merging tasks (to explain the name) queries for URLs are answered by query (in herited) More...
 
virtual CIDRelevanceLevelPairListfastQueryByFeature (const CWeightingFunctionPointerList &inQuery, int inNumberOfInterestingImages, double inDifferenceToBest)
 Assuming that a correct CWeightingFunctionPointerHash has been built by fastQuery (or another function), this function will do the rest. More...
 
double DIDToScore (TID inDID, const CWeightingFunctionPointerHash &inQuery) const
 Returns the score for one image in the query. More...
 
double URLToScore (const string &inURL, const CWeightingFunctionPointerHash &inQuery) const
 Returns the score for one image in the query. More...
 
double FeatureListToScore (TID inDID, const CDocumentFrequencyList &inFeatureList, const CWeightingFunctionPointerHash &inQuery) const
 Turns the featurelist of a document into a score.
 
void buildNormalizedQueryHash (const CRelevanceLevel &inQuery, CWeightingFunctionPointerHash &outQueryFeatureWeighters) const
 
void activateBlockingFeatures ()
 activateBlockingFeatures - sets the variable to block groups of features More...
 
void releaseBlockingFeatures ()
 releaseBlockingFeatures - this turns off the blocking of features More...
 
bool featuresBlocked () const
 featuresBlocked - returns true if the features are blocked More...
 
void blockFeatureGroup (const int featureNumber)
 blockFeatureGroup - this blocks one special group of features More...
 
void unblockFeatureGroup (const int featureNumber)
 unblockFeatureGroup - this releases the blocking of one feature group More...
 
bool isBlocked (const int featureNumber) const
 isBlocked - returns true if the feature is blocked and false if not More...
 
void releaseAllPrunings ()
 sets back all the variables for the pruning More...
 
void useFeaturePruning (double percentage)
 activates the feature pruning with evaluating a certain percentage of the features More...
 
void releaseFeaturePruning ()
 set the variables back to its normal status More...
 
void useTimePruning (double inTimeCutoffPoint)
 activates the time pruning with the give cuOffPoint More...
 
void releaseTimePruning ()
 releases the timePruning More...
 
void useScoreBoardPruning (double inCutAfterFraction, double inReduceToFactor)
 creates one entry in the scoreboardPruning More...
 
void releaseScoreBoardPruning ()
 releases all the settings for the ScorboardPruning More...
 
void useEvaluateAfterPruning ()
 activates the evaluation after the scoreboardPruning More...
 
void releaseEvaluateAfterPruning ()
 releases the evaluation after the scoreboard pruning More...
 
CWeightergetWeighter ()
 For FerDeLance queries.
 
- Public Member Functions inherited from CQuery
 CQuery ()
 default constructor More...
 
virtual ~CQuery ()
 destructor More...
 
 CQuery (CAccessorAdminCollection &inAccessorAdminCollection, CAlgorithm &inAlgorithm)
 this constructor takes all the information ANY CQuery needs to configure itself. More...
 
void addChild (CQuery *inChild, double inWeight=1)
 adding a child to this. More...
 
virtual CXMLElementquery (const CXMLElement &inQuery)
 do a query More...
 
virtual CXMLElementgetRandomImages (int inNumberOfInterestingImages) const
 get some random images (handed through to accessor) More...
 
virtual CIDRelevanceLevelPairListgetRandomIDs (int inNumberOfInterestingImages) const
 get some random images (handed through to accessor) More...
 
virtual list< TID > * getAllIDs () const
 get the IDs of all images (handed through to accessor) More...
 
virtual list< CAccessorElement > * getAllAccessorElements () const
 get the IDs of all images (handed through to accessor) More...
 
const CAlgorithmgetAlgorithm () const
 get the Algorithm. More...
 
- Public Member Functions inherited from CMagic
void check () const
 This function checks the magic number of this and asserts to zero, if something is wrong, if things are ok, this function keeps quiet.
 
void checkNPrint () const
 as check(), but it also prints a small message to cout, saying that the check worked.
 
 CMagic ()
 sets the magic number to 42
 
 ~CMagic ()
 sets the magic number to another value (36)
 

Public Attributes

bool mBlockingOn
 
bool mBlockingArray [MAXIMUMNUMBEROFEATUREGROUPS]
 
bool mPruningUsed
 Shows if any pruning is used.
 
bool mScoreBoardPruningUsed
 true if the scoreboardis Pruned
 
parameterPruningType mScoreBoardPruningArray [MAX_SCOREBOARD_PRUNINGS]
 Henning Müller
 
int mNumberofUsedScoreBoardPrunings
 Henning Müller
 
bool mFeaturePruningUsed
 
double mPercentageofFeatures
 Henning Müller
 
bool mTimePruningUsed
 
double mStoppingTime
 Henning Müller
 
bool mEvaluateAfterPruning
 

Static Public Attributes

static const int MAXIMUMNUMBEROFEATUREGROUPS =50
 
static const int MAX_SCOREBOARD_PRUNINGS =10
 These are the variables and functions used for the pruning process. More...
 

Protected Member Functions

double keepScore (CScoreBoard &inoutScoreBoard, const CWeightingFunctionPointerList &inFeatures, bool lPositive) const
 calculates the score for all the images based on a list of features More...
 
double keepScorePruning (CScoreBoard &inoutScoreBoard, const CWeightingFunctionPointerList &inFeatures, bool inPositive, int inDesiredNumberOfDocuments) const
 calculates the results for the images using some sort of pruning More...
 
void buildQueryHash (CRelevanceLevelList &inQuery, CWeightingFunctionPointerHash &outQueryFeatureWeighters) const
 creates a list of all the features which are in one or more of the query images should be replaced by a version which operates on IDs not URLs More...
 
void buildNormalizedQueryList (double inPositiveRelevanceSum, double inNegativeRelevanceSum, CWeightingFunctionPointerHash &inQFW, CWeightingFunctionPointerList &outQFW) const
 Building a list of normalized WF from a hash of Weighting functions. More...
 
void buildNormalizedQueryHash (double inPositiveRelevanceSum, double inNegativeRelevanceSum, CWeightingFunctionPointerHash &inQFW) const
 Building a list of normalized WF from a hash of Weighting functions. More...
 
void init ()
 Initializer, used by both construcors. More...
 

Protected Attributes

CAlgorithmmDeb
 
int mModulo
 You can choose to use only every lModulo-th feature.
 
int mModuloClass
 Every lModulo-th feature, starting at lModuloClass.
 
CWeighterFactory mWeighterFactory
 This is a factory for weighters. More...
 
CSelfDestroyPointer< CWeightermWeighter
 The weighter currently used.
 
CSelfDestroyPointer< CWeightingFunctionPointerHashmQueryFeatureWeighters
 object of this type to have a list of the features with the weights
 
- Protected Attributes inherited from CQuery
CAccessormAccessor
 needed to translate URLs to IDs this is a pointer, only because we cannot change references it does not imply any destruction responsability
 
CAccessorAdminmAccessorAdmin
 This is where the the Accessor comes from. More...
 
CAccessorAdminCollectionmAccessorAdminCollection
 Where to get CAccessorAdmins from.
 
CAlgorithmmAlgorithm
 the structure containing everything we know about the algorithm used do not destroy this
 
lCChildren mChildren
 The children of this.
 

Additional Inherited Members

- Protected Types inherited from CQuery
typedef list< lCChildlCChildren
 type for children of this
 

Detailed Description

The Query manager for Queries on inverted Files.

Constructor & Destructor Documentation

CQInvertedFile::CQInvertedFile ( CAccessorAdminCollection inAccessorAdminCollection,
CAlgorithm inAlgorithm 
)

New constructor, taking as parameter the algorithm structure, which contains all the algorithm configuration.

CQInvertedFile::~CQInvertedFile ( )

destructor

Member Function Documentation

void CQInvertedFile::activateBlockingFeatures ( )

activateBlockingFeatures - sets the variable to block groups of features

void CQInvertedFile::blockFeatureGroup ( const int  featureNumber)

blockFeatureGroup - this blocks one special group of features

void CQInvertedFile::buildNormalizedQueryHash ( double  inPositiveRelevanceSum,
double  inNegativeRelevanceSum,
CWeightingFunctionPointerHash inQFW 
) const
protected

Building a list of normalized WF from a hash of Weighting functions.

void CQInvertedFile::buildNormalizedQueryList ( double  inPositiveRelevanceSum,
double  inNegativeRelevanceSum,
CWeightingFunctionPointerHash inQFW,
CWeightingFunctionPointerList &  outQFW 
) const
protected

Building a list of normalized WF from a hash of Weighting functions.

void CQInvertedFile::buildQueryHash ( CRelevanceLevelList inQuery,
CWeightingFunctionPointerHash outQueryFeatureWeighters 
) const
protected

creates a list of all the features which are in one or more of the query images should be replaced by a version which operates on IDs not URLs

Author
Wolfgang Müller + Pruning: Henning Müller/reprogrammed WM 09-10-00
double CQInvertedFile::DIDToScore ( TID  inDID,
const CWeightingFunctionPointerHash inQuery 
) const

Returns the score for one image in the query.

virtual CIDRelevanceLevelPairList* CQInvertedFile::fastQuery ( const CXMLElement inQuery,
int  inNumberOfInterestingImages,
double  inDifferenceToBest 
)
virtual

a query which returns ID/RelevanceLevel pairs instead of instead of URL/RelevanceLevel pairs; this is faster for merging tasks (to explain the name) queries for URLs are answered by query (in herited)

Implements CQuery.

virtual CIDRelevanceLevelPairList* CQInvertedFile::fastQueryByFeature ( const CWeightingFunctionPointerList &  inQuery,
int  inNumberOfInterestingImages,
double  inDifferenceToBest 
)
virtual

Assuming that a correct CWeightingFunctionPointerHash has been built by fastQuery (or another function), this function will do the rest.

bool CQInvertedFile::featuresBlocked ( ) const

featuresBlocked - returns true if the features are blocked

void CQInvertedFile::init ( )
protectedvirtual

Initializer, used by both construcors.

Implements CQuery.

bool CQInvertedFile::isBlocked ( const int  featureNumber) const

isBlocked - returns true if the feature is blocked and false if not

double CQInvertedFile::keepScore ( CScoreBoard inoutScoreBoard,
const CWeightingFunctionPointerList &  inFeatures,
bool  lPositive 
) const
protected

calculates the score for all the images based on a list of features

Author
Wolfgang Müller
double CQInvertedFile::keepScorePruning ( CScoreBoard inoutScoreBoard,
const CWeightingFunctionPointerList &  inFeatures,
bool  inPositive,
int  inDesiredNumberOfDocuments 
) const
protected

calculates the results for the images using some sort of pruning

Author
Henning Müller
void CQInvertedFile::releaseAllPrunings ( )

sets back all the variables for the pruning

Henning Müller

void CQInvertedFile::releaseBlockingFeatures ( )

releaseBlockingFeatures - this turns off the blocking of features

void CQInvertedFile::releaseEvaluateAfterPruning ( )

releases the evaluation after the scoreboard pruning

Henning Müller

void CQInvertedFile::releaseFeaturePruning ( )

set the variables back to its normal status

Henning Müller

void CQInvertedFile::releaseScoreBoardPruning ( )

releases all the settings for the ScorboardPruning

Henning Müller

void CQInvertedFile::releaseTimePruning ( )

releases the timePruning

Henning Müller

virtual bool CQInvertedFile::setAlgorithm ( CAlgorithm inAlgorithm)
virtual

set the Algorithm.

same scheme as in setCollection

Reimplemented from CQuery.

void CQInvertedFile::unblockFeatureGroup ( const int  featureNumber)

unblockFeatureGroup - this releases the blocking of one feature group

double CQInvertedFile::URLToScore ( const string &  inURL,
const CWeightingFunctionPointerHash inQuery 
) const

Returns the score for one image in the query.

void CQInvertedFile::useEvaluateAfterPruning ( )

activates the evaluation after the scoreboardPruning

Henning Müller

void CQInvertedFile::useFeaturePruning ( double  percentage)

activates the feature pruning with evaluating a certain percentage of the features

Henning Müller

void CQInvertedFile::useScoreBoardPruning ( double  inCutAfterFraction,
double  inReduceToFactor 
)

creates one entry in the scoreboardPruning

Henning Müller

void CQInvertedFile::useTimePruning ( double  inTimeCutoffPoint)

activates the time pruning with the give cuOffPoint

Henning Müller

Member Data Documentation

const int CQInvertedFile::MAX_SCOREBOARD_PRUNINGS =10
static

These are the variables and functions used for the pruning process.

the maximum number of sets which can be used to prune the ScoreBoard

CWeighterFactory CQInvertedFile::mWeighterFactory
protected

This is a factory for weighters.

With this we can find the weighters


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