Changeset 613


Ignore:
Timestamp:
Aug 30, 2006, 4:40:51 PM (15 years ago)
Author:
Markus Ringnér
Message:

Sampler and SubsetGenerator? in progress. Fixes #103

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

Legend:

Unmodified
Added
Removed
  • trunk/c++_tools/classifier/CrossValidationSampler.h

    r612 r613  
    2727
    2828#include <c++_tools/classifier/Sampler.h>
    29 #include <c++_tools/classifier/Target.h>
    3029
    3130namespace theplu {
    3231namespace classifier { 
     32
     33  class Target;
    3334
    3435  ///
  • trunk/c++_tools/classifier/Sampler.h

    r610 r613  
    3333namespace theplu {
    3434namespace classifier { 
    35   class DataLookup2D;
    36   class FeatureSelector;
    3735
    3836  ///
     
    5250
    5351    ///
    54     /// Destructor
     52    /// Destructor (pure virtual destructor)
    5553    ///
    56     virtual ~Sampler();
    57 
    58     ///
    59     /// @return true if in a valid state
    60     ///
    61     inline bool more(void) const { return state_<size(); }
    62 
    63     ///
    64     /// Function turning the object to the next state.
    65     ///
    66     inline void next(void) { state_++; }
    67 
    68     ///
    69     /// rewind the sampler to initial state
    70     ///
    71     inline void reset(void) { state_=0; }
    72 
     54    virtual ~Sampler() =0;
    7355
    7456    ///
     
    7860
    7961    ///
    80     /// @return the target for the total set
     62    /// @return the targets for the total set
    8163    ///
    8264    inline const Target& target(void) const { return target_; }
    8365
    84 
    85     /// @return training index
    8666    ///
    87     /// @note if state is invalid the result is undefined
     67    /// @return training indices
    8868    ///
    89     inline const std::vector<size_t>& training_index(void) const
    90     { assert(more()); return training_index_[state_]; }
     69    inline const std::vector<size_t>&
     70    training_index(std::vector<size_t>::size_type i) const
     71    { assert(i<size()); return training_index_[i]; }
    9172
    9273    ///
     
    9576    /// @note if state is invalid the result is undefined
    9677    ///
    97     inline const Target& training_target(void) const
    98     { assert(more()); return training_target_[state_]; }
     78    inline const Target&
     79    training_target(std::vector<Target>::size_type i) const
     80    { assert(i<size()); return training_target_[i]; }
    9981
    10082    ///
     
    10385    /// @note if state is invalid the result is undefined
    10486    ///
    105     inline const std::vector<size_t>& validation_index(void) const
    106     { assert(more()); return validation_index_[state_]; }
     87    inline const std::vector<size_t>&
     88    validation_index(std::vector<size_t>::size_type i) const
     89    { assert(i<size()); return validation_index_[i]; }
    10790
    10891    ///
     
    11194    /// @note if state is invalid the result is undefined
    11295    ///
    113     inline const Target& validation_target(void) const
    114     { assert(more()); return validation_target_[state_]; }
     96    inline const Target&
     97    validation_target(std::vector<Target>::size_type i) const
     98    { assert(i<size()); return validation_target_[i]; }
    11599
    116100
     
    122106    std::vector<Target> validation_target_;
    123107
    124   private:
    125     u_long state_;
    126 
    127108  };
    128109
Note: See TracChangeset for help on using the changeset viewer.