Changeset 630


Ignore:
Timestamp:
Sep 5, 2006, 10:37:07 AM (15 years ago)
Author:
Peter
Message:

fixes #117

Location:
trunk/c++_tools/classifier
Files:
2 edited

Legend:

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

    r624 r630  
    7979
    8080
    81   InputRanker::InputRanker(const DataLookup2D& data,
    82                            const Target& target,
    83                            statistics::Score& score_object,
    84                            const MatrixLookup& weight)
    85   {
    86     size_t nof_genes = data.rows();
    87 
    88     //scoring each input
    89     std::vector<std::pair<double, size_t> > score;
    90     for (size_t i=0; i<nof_genes; i++) {
    91       double area = score_object.score(target, DataLookup1D(data,i,true),
    92                                        DataLookup1D(weight,i,true));     
    93       assert(!std::isnan(area));
    94       std::pair<double, size_t> tmp(area,i);
    95       score.push_back(tmp);
    96     }
    97 
    98     //sort the scores and assign id_ and rank_
    99     sort(score.begin(), score.end(), std::greater<std::pair<double,size_t> >());
    100 
    101     id_.resize(nof_genes);
    102     rank_.resize(nof_genes);
    103     for (size_t i=0; i<nof_genes; i++){
    104       id_[i]=score[i].second;
    105       rank_[id_[i]]=i;           
    106     }
    107 
    108   }
    109 
    110 
    11181}} // of namespace classifier and namespace theplu
  • trunk/c++_tools/classifier/InputRanker.h

    r624 r630  
    4343
    4444    ///
    45     /// Constructor taking data, target, weight, pointer to a Score
    46     /// object and vector defining what samples to use (default is to
    47     /// use all samples)
    48     ///
    49     /// @nore this constructor will be removed
    50     InputRanker(const DataLookup2D&, const Target&, statistics::Score&,
    51                 const MatrixLookup&);
    52 
    53 
    54     ///
    5545    /// highest ranked gene is ranked as number zero @return id
    5646    /// (index) of input ranked as number \a i
Note: See TracChangeset for help on using the changeset viewer.