Skip to content
Snippets Groups Projects
Commit ee3b0a5d authored by Martin Beseda's avatar Martin Beseda
Browse files

ENH: added de_normalize() method to DataSet class.

parent 8f8aa286
No related branches found
No related tags found
No related merge requests found
...@@ -351,6 +351,25 @@ namespace lib4neuro { ...@@ -351,6 +351,25 @@ namespace lib4neuro {
} }
} }
void DataSet::de_normalize() {
std::vector<double> tmp_inp(this->data.at(0).first.size());
std::vector<double> tmp_out(this->data.at(0).second.size());
for(auto& pair: this->data) {
for(size_t i=0; i < pair.first.size(); i++) {
tmp_inp.at(i) = this->normalization_strategy->de_normalize(pair.first.at(i));
}
pair.first = tmp_inp;
}
for(auto& pair: this->data) {
for(size_t i=0; i < pair.second.size(); i++) {
tmp_out.at(i) = this->normalization_strategy->de_normalize(pair.second.at(i));
}
pair.second = tmp_out;
}
}
void DataSet::de_normalize_single(std::vector<double> &d1, std::vector<double> &d2){ void DataSet::de_normalize_single(std::vector<double> &d1, std::vector<double> &d2){
assert(d1.size() == d2.size()); assert(d1.size() == d2.size());
for (size_t j = 0; j < d1.size(); ++j) { for (size_t j = 0; j < d1.size(); ++j) {
......
...@@ -233,6 +233,11 @@ namespace lib4neuro { ...@@ -233,6 +233,11 @@ namespace lib4neuro {
*/ */
LIB4NEURO_API void normalize(); LIB4NEURO_API void normalize();
/**
* Denormalizes the data set
*/
LIB4NEURO_API void de_normalize();
/** /**
* stores the de-normalized vector @d1 into @d2 * stores the de-normalized vector @d1 into @d2
* @param d1 * @param d1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment