-
Notifications
You must be signed in to change notification settings - Fork 0
/
TrainingDatum.h
63 lines (51 loc) · 1.16 KB
/
TrainingDatum.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
#ifndef TRAININGDATA_H
#define TRAININGDATA_H
template <typename T>
class TrainingDatum
{
public:
TrainingDatum()
{
_observation = T();
_classification = -1;
}
TrainingDatum(const TrainingDatum<T>& other)
{
copy(other);
}
TrainingDatum(const T& observation, int classification)
{
_observation = observation;
_classification = classification;
}
TrainingDatum<T>& operator=(const TrainingDatum<T>& other)
{
copy(other);
return *this;
}
void setObservation(const T& observation)
{
_observation = observation();
}
const T& observation() const
{
return _observation;
}
void setClassification(int classification)
{
_classification = classification;
}
int classification() const
{
return _classification;
}
private:
void copy(const TrainingDatum<T>& other)
{
_observation = other._observation;
_classification = other._classification;
}
T _observation;
int _classification;
};
#endif // TRAININGDATA_H