Changeset 619 for trunk


Ignore:
Timestamp:
Sep 4, 2006, 6:20:20 AM (15 years ago)
Author:
Peter
Message:

fixes #107 and refs #105 fixed bug in EnsembleBuilder? and removed some assert in header files

Location:
trunk
Files:
6 edited

Legend:

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

    r616 r619  
    1616  EnsembleBuilder::EnsembleBuilder(const SupervisedClassifier& sc,
    1717                                   SubsetGenerator& subset)
    18     : mother_(sc), subset_(subset_)
     18    : mother_(sc), subset_(subset)
    1919  {
    2020  }
  • trunk/c++_tools/classifier/Sampler.h

    r613 r619  
    2828#include <c++_tools/classifier/Target.h>
    2929
    30 #include <cassert>
    3130#include <vector>
    3231
     
    6968    inline const std::vector<size_t>&
    7069    training_index(std::vector<size_t>::size_type i) const
    71     { assert(i<size()); return training_index_[i]; }
     70    { return training_index_[i]; }
    7271
    7372    ///
     
    7877    inline const Target&
    7978    training_target(std::vector<Target>::size_type i) const
    80     { assert(i<size()); return training_target_[i]; }
     79    { return training_target_[i]; }
    8180
    8281    ///
     
    8786    inline const std::vector<size_t>&
    8887    validation_index(std::vector<size_t>::size_type i) const
    89     { assert(i<size()); return validation_index_[i]; }
     88    { return validation_index_[i]; }
    9089
    9190    ///
     
    9695    inline const Target&
    9796    validation_target(std::vector<Target>::size_type i) const
    98     { assert(i<size()); return validation_target_[i]; }
     97    { return validation_target_[i]; }
    9998
    10099
  • trunk/c++_tools/classifier/SubsetGenerator.cc

    r615 r619  
    2727    validation_weight_.reserve(sampler_.size());
    2828    for (size_t i=0; i<sampler_.size(); ++i){
    29      
    3029      // Dynamically allocated. Must be deleted in destructor.
    3130      training_data_.push_back(data.training_data(sampler.training_index(i)));
     
    4039
    4140
    42       training_target_.push_back(Target(target(),sampler.training_index(1)));
     41      training_target_.push_back(Target(target(),sampler.training_index(i)));
    4342      validation_target_.push_back(Target(target(),
    4443                                          sampler.validation_index(i)));
     
    7170    : sampler_(sampler), state_(0), weighted_(true)
    7271  {
    73     std::cout << "Creating SubsetGenerator" << this << std::endl;
    7472    assert(target().size()==data.columns());
    7573    training_data_.reserve(size());
     
    113111    : f_selector_(&fs), sampler_(sampler), state_(0), weighted_(false)
    114112  {
    115     std::cout << "Creating SubsetGenerator" << this << std::endl;
    116113    assert(target().size()==data.columns());
    117114
  • trunk/c++_tools/classifier/SubsetGenerator.h

    r615 r619  
    2828#include <c++_tools/classifier/Sampler.h>
    2929
    30 #include <cassert>
    3130#include <vector>
    3231
     
    9392    ///
    9493    inline void reset(void) { state_=0; }
    95 
     94 
    9695    ///
    9796    /// @return number of subsets
     
    108107    /// @return the target for the total set
    109108    ///
    110     inline const Sampler& sampler(void) const { return sampler_; }
     109    //    inline const Sampler& sampler(void) const { return sampler_; }
    111110
    112111
     
    115114    ///
    116115    inline const DataLookup2D& training_data(void) const
    117     { assert(more()); return *(training_data_[state_]); }
     116    { return *(training_data_[state_]); }
    118117
    119118    ///
     
    121120    ///
    122121    inline const std::vector<size_t>& training_features(void) const
    123     { assert(more()); return f_selector_ ? features_[state_] : features_[0]; }
     122    { return f_selector_ ? features_[state_] : features_[0]; }
    124123
    125124
     
    128127    ///
    129128    inline const std::vector<size_t>& training_index(void) const
    130     { assert(more()); return sampler_.training_index(state_); }
     129    { return sampler_.training_index(state_); }
    131130
    132131    ///
     
    134133    ///
    135134    inline const Target& training_target(void) const
    136     { assert(more()); return training_target_[state_]; }
     135    { return training_target_[state_]; }
    137136
    138137    ///
     
    140139    /// @todo remove this function
    141140    inline const MatrixLookup& training_weight(void) const
    142     { assert(more()); return *(training_weight_[state_]); }
     141    { return *(training_weight_[state_]); }
    143142
    144143    ///
     
    146145    ///
    147146    inline const DataLookup2D& validation_data(void) const
    148     { assert(more()); return *(validation_data_[state_]); }
     147    { return *(validation_data_[state_]); }
    149148
    150149    ///
     
    152151    ///
    153152    inline const std::vector<size_t>& validation_index(void) const
    154     { assert(more()); return sampler_.validation_index(state_); }
     153    { return sampler_.validation_index(state_); }
    155154
    156155    ///
     
    158157    ///
    159158    inline const Target& validation_target(void) const
    160     { assert(more()); return validation_target_[state_]; }
     159    { return validation_target_[state_]; }
    161160
    162161    ///
     
    164163    /// @todo remove this function
    165164    inline const MatrixLookup& validation_weight(void) const
    166     { assert(more()); return *(validation_weight_[state_]); }
     165    { return *(validation_weight_[state_]); }
    167166
    168167    ///
  • trunk/configure.ac

    r617 r619  
    6262AC_CHECK_FUNCS([pow sqrt])
    6363
    64 #CXXFLAGS="-g -O -Wall -pedantic"
    65 #CPPFLAGS="-DHAVE_INLINE=1"
     64CXXFLAGS="-g -O -Wall -pedantic"
     65CPPFLAGS="-DHAVE_INLINE=1"
    6666# Use these flags when compiling a production library
    67 CXXFLAGS="-O3 -Wall -pedantic"
    68 CPPFLAGS="-DNDEBUG -DGSL_RANGE_CHECK_OFF -DHAVE_INLINE=1"
     67#CXXFLAGS="-O3 -Wall -pedantic"
     68#CPPFLAGS="-DNDEBUG -DGSL_RANGE_CHECK_OFF -DHAVE_INLINE=1"
    6969
    7070AC_CHECK_LIB(m,main,[MATH_LIB="-lm" LIBS="-lm $LIBS"])
  • trunk/test/ensemble_test.cc

    r616 r619  
    2020
    2121
     22#include <c++_tools/classifier/NCC.h>
     23#include <c++_tools/statistics/PearsonDistance.h>
    2224
    2325int main(const int argc,const char* argv[])
     
    5254  classifier::Target target(is);
    5355  is.close();
     56  assert(data.columns()==target.size());
    5457
    5558  *error << "create KernelLookup" << std::endl;
     
    6568  *error << "build ensemble" << std::endl;
    6669  cv.reset();
    67   //  ensemble.build();
     70  ensemble.build();
    6871 
    6972  delete kf;
Note: See TracChangeset for help on using the changeset viewer.