forked from mblum/libgp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsampleset.h
executable file
·68 lines (49 loc) · 1.55 KB
/
sampleset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// libgp - Gaussian process library for Machine Learning
// Copyright (c) 2013, Manuel Blum <[email protected]>
// All rights reserved.
#ifndef __SAMPLESET_H__
#define __SAMPLESET_H__
#include <Eigen/Dense>
#include <vector>
namespace libgp {
/** Container holding training patterns.
* @author Manuel Blum */
class SampleSet
{
public:
/** Constructor.
* @param input_dim dimensionality of input vectors */
SampleSet (int input_dim);
/** Destructor. */
virtual ~SampleSet();
/** Add input-output pattern to sample set.
* @param x input array
* @param y target value */
void add(const double x[], double y);
void add(const Eigen::VectorXd x, double y);
/** Get input vector at index k. */
const Eigen::VectorXd & x (size_t k);
/** Get target value at index k. */
double y (size_t k);
/** Set target value at index i. */
bool set_y(size_t i, double y);
/** Get reference to vector of target values. */
const std::vector<double>& y();
/** Get number of samples. */
size_t size();
/** Clear sample set. */
void clear();
/** Check if sample set is empty. */
bool empty ();
private:
/** Container holding input vectors. */
std::vector<Eigen::VectorXd *> inputs;
/** Container holding target values. */
std::vector<double> targets;
/** Dimensionality of input vectors. */
size_t input_dim;
/** Number of samples. */
size_t n;
};
}
#endif /* __SAMPLESET_H__ */