-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDataObject.h
More file actions
104 lines (100 loc) · 3.27 KB
/
DataObject.h
File metadata and controls
104 lines (100 loc) · 3.27 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
///////////////////////////////////////////////////////////
// DataObject.h
// Implementation of the Class DataObject
// Created on: 07-Lie-2013 20:07:29
// Original author: Povilas
///////////////////////////////////////////////////////////
/*! \file DataObject class
\brief A class of methods and attributes for manipulating features in data vectors.
*/
#if !defined(DATAOBJECT_H)
#define DATAOBJECT_H
#include <vector>
/*! \file DataObject
* \brief Class that represents data object
*/
class DataObject
{
public:
/*!
* A default constructor.
*/
DataObject();
/*!
* A destructor.
*/
virtual ~DataObject();
/*!
* An overloaded constructor that accepts the number of the features.
*/
DataObject(int featureCount);
/*!
* An overloaded constructor that accepts the number of the features and a class label.
*/
DataObject(int featureCount, int classLabel);
/*!
* An overloaded constructor that accepts the vector of the features.
*/
DataObject(std::vector<double> v, int classLabel = -1);
/*! \fn int getClassLabel();
* \brief Returns the class label.
* \return classLabel - the class label.
*/
int getClassLabel();
/*! \fn int getFeatureCount();
* \brief Returns the number of features.
* \return featureCount - the number of features.
*/
int getFeatureCount();
/*! \fn void setClassLabel(int classLabel);
* \brief Sets the class label.
* \param classLabel - the class label.
*/
void setClassLabel(int classLabel);
/*! \fn double getFeatureAt(int index);
* \brief Returns the feature at specified index.
* \param index - a zero-based index of the element in a features list.
* \return feature - a feature at index \a index.
*/
double getFeatureAt(int index);
/*! \fn void setNumOfFeatures(int);
* \brief Sets the number of features.
* \param num - a number of features.
*/
void setNumOfFeatures(int num);
/*! \fn bool IsIdentical(DataObject other);
* \brief Checks if current DataObject is identical to the given one.
* \param otherObject - a DataObject that needs to be compared with \this DataObject.
* \return answer - a boolean value, \a true if DataObjects are identical, \a false otherwise.
*/
bool IsIdentical(DataObject otherObject);
/*! \fn void updateFeature(int featureIndex, double newValue);
* \brief Updates the feature value.
* \param featureIndex - a zero-based index of the feature in a list.
* \param newValue - a new value of a feature.
*/
void updateFeature(int featureIndex, double newValue);
/*! \fn std::vector<double> getFeatures();
* \brief Returns features of the current data object.
* \param std::vector<double>.
*/
std::vector<double> getFeatures();
private:
/*! \var int classLabel;
* \brief The label of the class.
*/
int classLabel;
/*! \var int featureCount;
* \brief The number of the features.
*/
int featureCount;
/*! \var int index;
* \brief The index of the feature.
*/
int index;
/*! \var vector<double> features;
* \brief The set of the features.
*/
std::vector<double> features;
};
#endif //!defined(DATAOBJECT_H)