autoDoc/HTML/---libInvertedFile-include-CWeightedFeature-h

    /* -*- mode: c++ -*-
    */
    /*

        GIFT, a flexible content based image retrieval system.
        Copyright (C) 1998, 1999, 2000 CUI, University of Geneva

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    */
    // -*- mode: c++ -*-
    #ifndef _CWEIGHTEDFEATURE
    #define _CWEIGHTEDFEATURE

    #include <functional>
    #include "TID.h"

    /** STOP! we can do this with standard weighting functions.
        It would mean we add rocchio. */

    /** This class contains a feature which is associated with
        two probabilistic weights:

        the probability that the feature is IMPORTANT in a given
            query context (positive or negative

        the probability that a feature is WANTED by the user.

    */
    class CWeightedFeature{
     public:
      /** the ID of the feature, as it would be used for queries */
      TID mFeatureID;
      /** the number of documents looked at which have */
      double mCountPresentPositive;
      /** the probability that a feature is not wanted */
      double mCountAbsentNegative;
      /** an a-priori weight (probably log of inverse frequency of feature) */
      double mAPrioriWeight;
      /** the number of documents looked at
          (necessary for getting at probabilities
       */

      /** a default constructor which just sets the starting values.
       */
      CWeightedFeature(TID inFeatureID=0,
    		   double inProbabilities=1,
    		   double inAPrioriWeight=1);
    };

    /** for sorting weighted features, sort by the feature-id */
    class CSortByFeatureID_WFe:public binary_function<CWeightedFeature.html">CWeightedFeature,CWeightedFeature.html">CWeightedFeature,bool>{
      //
     public:
      bool operator()(const CWeightedFeature& l,
    		  const CWeightedFeature& t)const;

    };

    #endif