source: trunk/yat/classifier/Sampler.cc @ 1090

Last change on this file since 1090 was 1000, checked in by Jari Häkkinen, 14 years ago

trac moved to new location.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1// $Id: Sampler.cc 1000 2007-12-23 20:09:15Z jari $
2
3/*
4  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
5  Copyright (C) 2007 Peter Johansson
6
7  This file is part of the yat library, http://trac.thep.lu.se/yat
8
9  The yat library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version.
13
14  The yat library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22  02111-1307, USA.
23*/
24
25#include "Sampler.h"
26#include "Target.h"
27
28namespace theplu {
29namespace yat {
30namespace classifier { 
31
32  Sampler::Sampler(const Target& target, size_t N)
33    : target_(target)
34  { 
35    training_index_.reserve(N);
36    training_target_.reserve(N);
37    validation_index_.reserve(N);
38    validation_target_.reserve(N);
39  }
40
41  Sampler::~Sampler()
42  { 
43  }
44
45  u_long Sampler::size(void) const
46  {
47    return training_index_.size();
48  }
49
50  const Target& Sampler::target(void) const
51  {
52    return target_;
53  }
54
55  const std::vector<size_t>&
56  Sampler::training_index(std::vector<size_t>::size_type i) const
57  {
58    return training_index_[i];
59  }
60
61  const Target& 
62  Sampler::training_target(std::vector<Target>::size_type i) const 
63  {
64    return training_target_[i];
65  }
66
67  const std::vector<size_t>& 
68  Sampler::validation_index(std::vector<size_t>::size_type i) const
69  {
70    return validation_index_[i];
71  }
72
73  const Target& 
74  Sampler::validation_target(std::vector<Target>::size_type i) const 
75  {
76    return validation_target_[i];
77  }
78
79}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.