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

Last change on this file since 1486 was 1486, checked in by Jari Häkkinen, 15 years ago

Addresses #436.

  • 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 1486 2008-09-09 21:17:19Z 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 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  size_t 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 utility::Index& Sampler::training_index(size_t i) const
56  {
57    return training_index_[i];
58  }
59
60  const Target& Sampler::training_target(size_t i) const 
61  {
62    return training_target_[i];
63  }
64
65  const utility::Index& Sampler::validation_index(size_t i) const
66  {
67    return validation_index_[i];
68  }
69
70  const Target& Sampler::validation_target(size_t i) const 
71  {
72    return validation_target_[i];
73  }
74
75}}} // of namespace classifier, yat, and theplu
Note: See TracBrowser for help on using the repository browser.