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

Last change on this file since 1615 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1// $Id: Sampler.cc 1487 2008-09-10 08:41:36Z jari $
2
3/*
4  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
5  Copyright (C) 2008 Peter Johansson
6
7  This file is part of the yat library, http://dev.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 3 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 yat. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include "Sampler.h"
24#include "Target.h"
25
26namespace theplu {
27namespace yat {
28namespace classifier { 
29
30  Sampler::Sampler(const Target& target, size_t N)
31    : target_(target)
32  { 
33    training_index_.reserve(N);
34    training_target_.reserve(N);
35    validation_index_.reserve(N);
36    validation_target_.reserve(N);
37  }
38
39  Sampler::~Sampler()
40  { 
41  }
42
43  size_t Sampler::size(void) const
44  {
45    return training_index_.size();
46  }
47
48  const Target& Sampler::target(void) const
49  {
50    return target_;
51  }
52
53  const utility::Index& Sampler::training_index(size_t i) const
54  {
55    return training_index_[i];
56  }
57
58  const Target& Sampler::training_target(size_t i) const 
59  {
60    return training_target_[i];
61  }
62
63  const utility::Index& Sampler::validation_index(size_t i) const
64  {
65    return validation_index_[i];
66  }
67
68  const Target& Sampler::validation_target(size_t i) const 
69  {
70    return validation_target_[i];
71  }
72
73}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.