Ignore:
Timestamp:
Mar 19, 2007, 11:15:43 PM (15 years ago)
Author:
Peter
Message:

Generalized ConsenusInputRanker?, Fixes #151

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/ConsensusInputRanker.h

    r817 r828  
    2727#include "InputRanker.h"
    2828
     29#include <vector>
     30
    2931namespace theplu {
    3032namespace yat {
    31 
    32   class statistics::Score;
    33 
     33namespace statistics {
     34  class Score;
     35  class VectorFunction;
     36}
    3437namespace classifier { 
    3538
     
    4649  /// could be different because they are based upon different
    4750  /// sub-sets of the data, or the different lists could be different
    48   /// because they have are generated using different criteria. Having
     51  /// because they have been generated using different criteria. Having
    4952  /// \f$ N \f$ lists means each row in the data matrix has \f$ N \f$
    50   /// ranks (each corresponding to one list) and a consensus ranked
    51   /// list is created by sorting the data rows with respect to their
    52   /// median rank.
     53  /// ranks (each corresponding to one list). A
     54  /// statistics::VectorFunction is used to boil down these ranks to
     55  /// one consensus rank, and a ranked list is created by sorting the
     56  /// data rows with respect to this consensus rank.
    5357  ///
    5458  /// For the time being there are two ways to build a
    5559  /// ConsensusInputRanker. 1) Sending a Sampler and a MatrixLookup to
    56   /// the constructor will create one ranked list for each of the
     60  /// the add function will create one ranked list for each of the
    5761  /// partitions defined in the Sampler. 2) You can generate
    5862  /// your ranked list outside, using your favourite method, and
     
    7175    /// Truly does nothing but creates a few empty member vectors.
    7276    ///
    73     ConsensusInputRanker(const IRRetrieve&);
     77    ConsensusInputRanker(const IRRetrieve&, const statistics::VectorFunction&);
    7478   
    7579    ///
     
    7983    /// the median rank (i.e. update() is called).
    8084    ///
    81     ConsensusInputRanker(const Sampler& sampler, const MatrixLookup&,
    82                          statistics::Score& s, const IRRetrieve&);
     85    void add(const Sampler& sampler, const MatrixLookup&, statistics::Score& s);
    8386   
    8487    ///
     88    /// @brief Add a set of InputRankers
     89    ///
    8590    /// Iterating through @a sampler creating subsets of @a data, and
    8691    /// for each subset is an InputRanker is created using the @a
     
    8893    /// the median rank (i.e. update() is called).
    8994    ///
    90     ConsensusInputRanker(const Sampler& sampler,
    91                          const MatrixLookupWeighted& data,
    92                          statistics::Score& score, const IRRetrieve&);
     95    void add(const Sampler& sampler, const MatrixLookupWeighted& data,
     96             statistics::Score& score);
    9397   
    9498    ///
    95     /// @brief add an InputRanker
     99    /// @brief Add an InputRanker
    96100    ///
    97101    /// @note update() must be called to make the added InputRanker to
     
    119123    size_t rank(size_t i) const;
    120124   
     125    /**
     126       \brief \brief reserve memory for internal vector of InputRankers
     127
     128       This function is recommended before adding using add(const
     129       InputRanker&) to avoid re-allocations.
     130    */
     131    void reserve(size_t n);
     132
     133
    121134    ///
    122135    /// update ids and ranks
     
    131144    std::vector<size_t> rank_;
    132145    const IRRetrieve& retriever_;
    133 
     146    const statistics::VectorFunction& vec_func_;
    134147  };
    135148
Note: See TracChangeset for help on using the changeset viewer.