Changeset 1004 for trunk/yat/classifier


Ignore:
Timestamp:
Jan 23, 2008, 7:24:53 PM (16 years ago)
Author:
Peter
Message:

adding a wrapper around std::random_shuffle that uses the RNG class. Changed all calls to random_shuffle to use the added function. Acctually all calls already used the RNG class so essentially this change is only cosmetic, but by providing a function I think it is easier to avoid using multiple random generators.

Location:
trunk/yat/classifier
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/CrossValidationSampler.cc

    r1002 r1004  
    6666    my_begin.push_back(target.size());
    6767
    68     random::DiscreteUniform rnd;
    69 
    7068    for (size_t i=0; i<N; ) {
    7169      // shuffle indices within class each class
    7270      for (size_t j=0; j+1<my_begin.size(); ++j)
    73         random_shuffle(v.begin()+my_begin[j],v.begin()+my_begin[j+1],rnd);
     71        random::random_shuffle(v.begin()+my_begin[j],v.begin()+my_begin[j+1]);
    7472     
    7573      for (size_t part=0; part<k && i<N; i++, part++) {
  • trunk/yat/classifier/FeatureSelectorRandom.cc

    r1000 r1004  
    6666    for (size_t i=0; i<total_N; ++i)
    6767      features_.push_back(i);
    68     random::DiscreteUniform rnd;
    6968    // Peter should use random_sample here, but not included in std
    70     std::random_shuffle(features_.begin(), features_.end(), rnd);
     69    random::random_shuffle(features_.begin(), features_.end());
    7170    features_.resize(N_);
    7271  }
  • trunk/yat/classifier/SVindex.cc

    r1000 r1004  
    120120  void SVindex::shuffle(void)
    121121  {
    122     random::DiscreteUniform a;
    123     random_shuffle(vec_.begin()+nof_sv_, vec_.end(), a);
     122    random::random_shuffle(vec_.begin()+nof_sv_, vec_.end());
    124123  }
    125124
  • trunk/yat/classifier/Target.cc

    r1000 r1004  
    167167  void Target::random_shuffle(void)
    168168  {
    169     random::DiscreteUniform d;
    170     std::random_shuffle(classes_.begin(), classes_.end(),d);
     169    random::random_shuffle(classes_.begin(), classes_.end());
    171170  }
    172171
Note: See TracChangeset for help on using the changeset viewer.