Changeset 1004
- Timestamp:
- Jan 23, 2008, 7:24:53 PM (16 years ago)
- Location:
- trunk/yat
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/classifier/CrossValidationSampler.cc
r1002 r1004 66 66 my_begin.push_back(target.size()); 67 67 68 random::DiscreteUniform rnd;69 70 68 for (size_t i=0; i<N; ) { 71 69 // shuffle indices within class each class 72 70 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]); 74 72 75 73 for (size_t part=0; part<k && i<N; i++, part++) { -
trunk/yat/classifier/FeatureSelectorRandom.cc
r1000 r1004 66 66 for (size_t i=0; i<total_N; ++i) 67 67 features_.push_back(i); 68 random::DiscreteUniform rnd;69 68 // 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()); 71 70 features_.resize(N_); 72 71 } -
trunk/yat/classifier/SVindex.cc
r1000 r1004 120 120 void SVindex::shuffle(void) 121 121 { 122 random::DiscreteUniform a; 123 random_shuffle(vec_.begin()+nof_sv_, vec_.end(), a); 122 random::random_shuffle(vec_.begin()+nof_sv_, vec_.end()); 124 123 } 125 124 -
trunk/yat/classifier/Target.cc
r1000 r1004 167 167 void Target::random_shuffle(void) 168 168 { 169 random::DiscreteUniform d; 170 std::random_shuffle(classes_.begin(), classes_.end(),d); 169 random::random_shuffle(classes_.begin(), classes_.end()); 171 170 } 172 171 -
trunk/yat/random/random.h
r1000 r1004 30 30 #include <gsl/gsl_randist.h> 31 31 32 #include <algorithm> 32 33 #include <string> 33 34 … … 555 556 }; 556 557 558 /** 559 \brief Convenience function to shuffle a range with singleton RNG. 560 561 Wrapper around std::random_shuffle using DiscreteUniform as 562 random generator and thereby using the underlying RNG class, 563 which is singleton. 564 */ 565 template<typename T> 566 void random_shuffle(T first, T last) 567 { 568 DiscreteUniform rnd; 569 std::random_shuffle(first, last, rnd); 570 } 571 557 572 }}} // of namespace random, yat, and theplu 558 573 -
trunk/yat/statistics/KolmogorovSmirnov.cc
r1003 r1004 1 1 // $Id$ 2 3 /* 4 Copyright (C) 2008 Peter Johansson 5 6 This file is part of the yat library, http://trac.thep.lu.se/yat 7 8 The yat library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License as 10 published by the Free Software Foundation; either version 2 of the 11 License, or (at your option) any later version. 12 13 The yat library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 21 02111-1307, USA. 22 */ 2 23 3 24 #include "KolmogorovSmirnov.h" -
trunk/yat/utility/vector.cc
r1000 r1004 521 521 void shuffle(vector& invec) 522 522 { 523 random::DiscreteUniform rnd; 524 std::random_shuffle(invec.begin(), invec.end(), rnd); 523 random::random_shuffle(invec.begin(), invec.end()); 525 524 } 526 525
Note: See TracChangeset
for help on using the changeset viewer.