Changeset 665


Ignore:
Timestamp:
Oct 5, 2006, 7:48:53 AM (15 years ago)
Author:
Peter
Message:

Fixes #142. Added access to score the InputRanking? is based upon. Perhaps the new member variable vector<double> score_ and vector<size_t> id_ could be merged to one vector<pair<double,size_t> to avoid some copying. However, that enforce a change in the interface (no vectors returned), so I close this ticket for now.

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

Legend:

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

    r630 r665  
    3232    for (size_t i=0; i<nof_genes; i++) {
    3333      double area = score_object.score(target,DataLookup1D(data,i,true));
    34       // Peter, remove stupid tmp
    35       std::pair<double, size_t> tmp(area,i);
    36       score.push_back(tmp);
     34      score.push_back(std::make_pair(area,i));
    3735    }
    3836
     
    4240    id_.resize(nof_genes);
    4341    rank_.resize(nof_genes);
     42    score_.resize(nof_genes);
    4443    for (size_t i=0; i<nof_genes; i++){
    4544      id_[i]=score[i].second;
     45      score_[i]=score[i].first;
    4646      rank_[id_[i]]=i;           
    4747    }
     
    6161    for (size_t i=0; i<nof_genes; i++) {
    6262      double area=score_object.score(target,DataLookupWeighted1D(data,i,true));
    63       // Peter, remove stupid tmp
    64       std::pair<double, size_t> tmp(area,i);
    65       score.push_back(tmp);
     63      score.push_back(std::make_pair(area,i));
    6664    }
    6765
     
    7371    for (size_t i=0; i<nof_genes; i++){
    7472      id_[i]=score[i].second;
     73      score_[i]=score[i].first;
    7574      rank_[id_[i]]=i;           
    7675    }
  • trunk/c++_tools/classifier/InputRanker.h

    r640 r665  
    5050    ///
    5151    /// highest ranked gene is ranked as number zero @return rank for
    52     /// id (column) \a i
     52    /// id (row) \a i
    5353    ///
    5454    inline const std::vector<size_t>& rank(void) const {return rank_;}
     55
     56    ///
     57    /// @param should be a number in range [0,N-1] where N is number
     58    /// of inputs in data matrix. "score(0)" will gives the score of
     59    /// the feature that had the highest score.
     60    ///
     61    /// @return score of the input that have been been ranked as
     62    /// number @a rank.
     63    ///
     64    inline double score(size_t rank) const { return score_[rank]; }
    5565
    5666
     
    5868    std::vector<size_t> id_;
    5969    std::vector<size_t> rank_;
     70    std::vector<double> score_;
    6071  };
    6172
Note: See TracChangeset for help on using the changeset viewer.