Hello,
I have this class:
class Value {
public:
double _value;
bool _missed;
};
class Feature {
double _mean;
vector<Value> _featVector;
void computeMean() {
for (int i=0; i < _featVector.size(); ++i) {
sum += _featVec[i]._value;
}
_mean = sum / _featVec.size();
}
void normalize() {
for (int i=0; i < _featVector.size(); ++i) {
_featVec[i]._value = /*normalization equation */
}
}
class Datas {
vector<Feature> _fet;
public:
void computeMean() {
for(int i=0; i < _feat.size(); ++i)
_feat[i].computeMean();
}
void normalize() {
for(int i=0; i < _feat.size(); ++i)
_feat[i].normalize();
}
//main.cpp
Datas data;
data.computeMean();
data.normalize();
class Value {
public:
double _value;
bool _missed;
};
class Feature {
double _mean;
vector<Value> _featVector;
void computeMean() {
for (int i=0; i < _featVector.size(); ++i) {
sum += _featVec[i]._value;
}
_mean = sum / _featVec.size();
}
void normalize() {
for (int i=0; i < _featVector.size(); ++i) {
_featVec[i]._value = /*normalization equation */
}
}
class Datas {
vector<Feature> _fet;
public:
void computeMean() {
for(int i=0; i < _feat.size(); ++i)
_feat[i].computeMean();
}
void normalize() {
for(int i=0; i < _feat.size(); ++i)
_feat[i].normalize();
}
//main.cpp
Datas data;
data.computeMean();
data.normalize();
To copy to clipboard, switch view to plain text mode
Beyond that utility of some things, the point is: Feature is able to compute the mean and normalization on itself BUT to compute it It's necessary call it from one other class....; is it good?
Furthermore: Will it better: class Feature : public vector<Value> { .....}
I hope of many opinions,
Bookmarks