Ignore:
Timestamp:
Dec 18, 2006, 5:01:41 PM (15 years ago)
Author:
Markus Ringnér
Message:

Fixes #104. Also fixed inline bug in Averager.h

File:
1 edited

Legend:

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

    r680 r704  
    6868    ///
    6969    ~SubsetGenerator();
    70 
    71     ///
    72     /// @return true if in a valid state
    73     ///
    74     inline bool more(void) const { return state_<size(); }
    75 
    76     ///
    77     /// Function turning the object to the next state.
    78     ///
    79     inline void next(void) { state_++; }
    80 
    81     ///
    82     /// rewind object to initial state
    83     ///
    84     inline void reset(void) { state_=0; }
    8570 
    8671    ///
     
    10489    /// @return training data
    10590    ///
    106     inline const DataLookup2D& training_data(void) const
    107     { return *(training_data_[state_]); }
     91    inline const DataLookup2D& training_data(std::vector<DataLookup2D*>::
     92                                             size_type i) const
     93    { return *(training_data_[i]); }
    10894
    10995    ///
    11096    /// @return training features
    11197    ///
    112     inline const std::vector<size_t>& training_features(void) const
    113     { return f_selector_ ? features_[state_] : features_[0]; }
     98    inline const std::vector<size_t>& training_features(std::vector<size_t>::
     99                                                        size_type i) const
     100    { return f_selector_ ? features_[i] : features_[0]; }
    114101
    115102
     
    117104    /// @return training index
    118105    ///
    119     inline const std::vector<size_t>& training_index(void) const
    120     { return sampler_.training_index(state_); }
     106    inline const std::vector<size_t>& training_index(std::vector<size_t>::
     107                                                     size_type i) const
     108    { return sampler_.training_index(i); }
    121109
    122110    ///
    123111    /// @return training target
    124112    ///
    125     inline const Target& training_target(void) const
    126     { return training_target_[state_]; }
     113    inline const Target& training_target(std::vector<Target>::
     114                                         size_type i) const
     115    { return training_target_[i]; }
    127116
    128117    ///
    129118    /// @return validation data
    130119    ///
    131     inline const DataLookup2D& validation_data(void) const
    132     { return *(validation_data_[state_]); }
     120    inline const DataLookup2D& validation_data(std::vector<DataLookup2D*>::
     121                                               size_type i) const
     122    { return *(validation_data_[i]); }
    133123
    134124    ///
    135125    /// @return validation index
    136126    ///
    137     inline const std::vector<size_t>& validation_index(void) const
    138     { return sampler_.validation_index(state_); }
     127    inline const std::vector<size_t>& validation_index(std::vector<size_t>::
     128                                                       size_type i) const
     129    { return sampler_.validation_index(i); }
    139130
    140131    ///
    141132    /// @return validation target
    142133    ///
    143     inline const Target& validation_target(void) const
    144     { return validation_target_[state_]; }
     134    inline const Target& validation_target(std::vector<Target>::
     135                                           size_type i) const
     136    { return validation_target_[i]; }
    145137
    146138    ///
     
    156148    std::vector<std::vector<size_t> > features_;
    157149    const Sampler& sampler_;
    158     size_t state_;
    159150    std::vector<const DataLookup2D*> training_data_;
    160151    std::vector<Target> training_target_;
Note: See TracChangeset for help on using the changeset viewer.