Ignore:
Timestamp:
Feb 23, 2008, 11:52:43 PM (14 years ago)
Author:
Peter
Message:

using Index class instead of std::vector<size_t>

File:
1 edited

Legend:

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

    r1125 r1134  
    3333#include "Target.h"
    3434#include "Sampler.h"
     35#include "yat/utility/Index.h"
    3536#include "yat/utility/yat_assert.h"
    3637
     
    103104    /// @return training features
    104105    ///
    105     const std::vector<size_t>&
     106    const utility::Index&
    106107    training_features(std::vector<size_t>::size_type i) const;
    107108
     
    109110    /// @return training index
    110111    ///
    111     const std::vector<size_t>&
     112    const utility::Index&
    112113    training_index(std::vector<size_t>::size_type i) const;
    113114
     
    125126    /// @return validation index
    126127    ///
    127     const std::vector<size_t>&
     128    const utility::Index&
    128129    validation_index(std::vector<size_t>::size_type i) const;
    129130
     
    147148
    148149    FeatureSelector* f_selector_;
    149     std::vector<std::vector<size_t> > features_;
     150    std::vector<utility::Index > features_;
    150151    const Sampler& sampler_;
    151152    std::vector<const T*> training_data_;
     
    185186    // No feature selection, hence features same for all partitions
    186187    // and can be stored in features_[0]
    187     features_.resize(1);
    188     features_[0].reserve(data.rows());
    189     for (size_t i=0; i<data.rows(); ++i)
    190       features_[0].push_back(i);
     188    features_.push_back(utility::Index(data.rows()));
    191189
    192190    utility::yat_assert<std::runtime_error>(training_data_.size()==size());
     
    298296                            training_target(k));
    299297      }
    300       std::vector<size_t> dummie=f_selector_->features();
     298      utility::Index dummie=f_selector_->features();
    301299      features_.push_back(dummie);
    302300      //features_.push_back(f_selector_->features());
     
    338336
    339337  template<typename T>
    340   const std::vector<size_t>&
    341   SubsetGenerator<T>::training_features(typename std::vector<size_t>::size_type i) const
     338  const utility::Index&
     339  SubsetGenerator<T>::training_features(size_t i) const
    342340  {
    343341    return f_selector_ ? features_[i] : features_[0];
     
    346344
    347345  template<typename T>
    348   const std::vector<size_t>&
    349   SubsetGenerator<T>::training_index(std::vector<size_t>::size_type i) const
     346  const utility::Index&
     347  SubsetGenerator<T>::training_index(size_t i) const
    350348  {
    351349    return sampler_.training_index(i);
     
    370368
    371369  template<typename T>
    372   const std::vector<size_t>&
     370  const utility::Index&
    373371  SubsetGenerator<T>::validation_index(std::vector<size_t>::size_type i) const
    374372  {
Note: See TracChangeset for help on using the changeset viewer.