Changeset 604 for trunk


Ignore:
Timestamp:
Aug 29, 2006, 11:45:01 AM (17 years ago)
Author:
Peter
Message:

ref #96 Changed InputRanker? to return vector of index rather than element. Also added draft to FeatureSelection? class.

Location:
trunk
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/c++_tools/classifier/ConsensusInputRanker.cc

    r560 r604  
    5353      std::vector<size_t> ranks(input_rankers_.size());
    5454      for (size_t j=0; j<input_rankers_.size(); j++) {
    55         ranks[j]=input_rankers_[j].rank(i);
     55        ranks[j]=input_rankers_[j].rank()[i];
    5656      }
    5757      medians[i].first = statistics::median(ranks);
  • trunk/c++_tools/classifier/DataLookup2D.h

    r592 r604  
    9696
    9797    ///
     98    /// @todo doc
     99    ///
     100    virtual const DataLookup2D* selected(const std::vector< size_t > &) const=0;
     101
     102    ///
    98103    /// @return sub-Lookup of the DataLookup2D
    99104    ///
  • trunk/c++_tools/classifier/InputRanker.h

    r482 r604  
    4949    /// (index) of input ranked as number \a i
    5050    ///
    51     inline size_t id(const size_t i) const {return id_[i];}
     51    inline const std::vector<size_t>& id(void) const {return id_;}
    5252
    5353    ///
     
    5555    /// id (column) \a i
    5656    ///
    57     inline size_t rank(const size_t i) const {return rank_[i];}
     57    inline const std::vector<size_t> rank(void) const {return rank_;}
    5858
    5959
  • trunk/c++_tools/classifier/Makefile.am

    r595 r604  
    3030  DataLookup2D.cc \
    3131  EnsembleBuilder.cc \
     32  FeatureSelector.cc \
     33  FeatureSelectorIR.cc \
    3234  GaussianKernelFunction.cc \
    3335  IGP.cc \
     
    5759  DataLookup2D.h \
    5860  EnsembleBuilder.h \
     61  FeatureSelector.h \
     62  FeatureSelectorIR.h \
    5963  GaussianKernelFunction.h \
    6064  IGP.h \
  • trunk/c++_tools/classifier/MatrixLookup.cc

    r593 r604  
    124124
    125125  const MatrixLookup*
     126  MatrixLookup::selected(const std::vector<size_t>& i) const
     127  {
     128    return new MatrixLookup(*this,i, true);
     129  }
     130
     131
     132
     133  const MatrixLookup*
    126134  MatrixLookup::training_data(const std::vector<size_t>& i) const
    127135  {
  • trunk/c++_tools/classifier/MatrixLookup.h

    r590 r604  
    161161    virtual ~MatrixLookup();
    162162
    163    
     163    ///
     164    /// @todo doc
     165    ///   
     166    const MatrixLookup* selected(const std::vector<size_t>&) const;
     167
    164168    ///
    165169    /// The created MatrixLookup corresponds to all rows and the
  • trunk/c++_tools/classifier/MatrixLookupWeighted.cc

    r595 r604  
    163163
    164164  const MatrixLookupWeighted*
     165  MatrixLookupWeighted::selected(const std::vector<size_t>& i) const
     166  {
     167    return new MatrixLookupWeighted(*this,i, true);
     168  }
     169
     170
     171
     172  const MatrixLookupWeighted*
    165173  MatrixLookupWeighted::training_data(const std::vector<size_t>& i) const
    166174  {
  • trunk/c++_tools/classifier/MatrixLookupWeighted.h

    r597 r604  
    177177    virtual ~MatrixLookupWeighted();
    178178
    179    
     179    ///
     180    /// @todo doc
     181    ///   
     182    const MatrixLookupWeighted*
     183    selected(const std::vector<size_t>& index) const;
     184
    180185    ///
    181186    /// The created MatrixLookupWeighted corresponds to all rows and the
     
    190195    /// undefined.
    191196    ///
    192     const MatrixLookupWeighted* training_data(const std::vector<size_t>& index) const;
     197    const MatrixLookupWeighted*
     198    training_data(const std::vector<size_t>& index) const;
    193199   
    194200    ///
  • trunk/c++_tools/classifier/NCC.cc

    r593 r604  
    108108        double weight=(*weights_)(i,j);
    109109        if(score_) {
    110           value=matrix_(ranker_->id(i),j);
    111           weight=(*weights_)(ranker_->id(i),j);
     110          value=matrix_(ranker_->id()[i],j);
     111          weight=(*weights_)(ranker_->id()[i],j);
    112112        }
    113113        if(weight) {
     
    135135      value(i)=input(i);
    136136      if(ranker_)
    137         value(i)=input(ranker_->id(i));
     137        value(i)=input(ranker_->id()[i]);
    138138      if(!std::isnan(value(i)))
    139139        w(i)=1.0;
  • trunk/c++_tools/classifier/SVM.cc

    r593 r604  
    8484    index.reserve(nof_inputs);
    8585    for (size_t i=0; i<nof_inputs; i++)
    86       index.push_back(ranker_->id(i));
     86      index.push_back(ranker_->id()[i]);
    8787    kernel_ = kernel.selected(index);
    8888    assert(kernel_->rows()==kernel.rows());
     
    143143      index.reserve(nof_inputs_);
    144144      for (size_t i=0; i<nof_inputs_; i++)
    145         index.push_back(ranker_->id(i));
     145        index.push_back(ranker_->id()[i]);
    146146      kernel_pointer = input_kernel.selected(index);
    147147    }
  • trunk/test/inputranker_test.cc

    r536 r604  
    3939  statistics::ROC roc;
    4040  classifier::InputRanker ir(data,target,roc);
    41   if (ir.id(0)!=2 || ir.id(1)!=0 || ir.id(2)!=1){
     41  if (ir.id()[0]!=2 || ir.id()[1]!=0 || ir.id()[2]!=1){
    4242    *error << "wrong id" << std::endl;
    4343    ok=false;
    4444  }
    4545 
    46   if (ir.rank(0)!=1 || ir.rank(1)!=2 || ir.rank(2)!=0){
     46  if (ir.rank()[0]!=1 || ir.rank()[1]!=2 || ir.rank()[2]!=0){
    4747    *error << "wrong rank" << std::endl;
    4848    ok=false;
Note: See TracChangeset for help on using the changeset viewer.