Skip to content
Snippets Groups Projects
NormalizationStrategy.cpp 1.19 KiB
Newer Older
  • Learn to ignore specific revisions
  • #include <cmath>
    #include <stdexcept>
    #include <boost/serialization/export.hpp>
    
    
    #include "NormalizationStrategySerialization.h"
    
    #include "exceptions.h"
    
    
    BOOST_CLASS_EXPORT_IMPLEMENT(NormalizationStrategy);
    BOOST_CLASS_EXPORT_IMPLEMENT(DoubleUnitStrategy);
    
    double NormalizationStrategy::get_max_value() {
    
    }
    
    double NormalizationStrategy::get_min_value() {
    
    
    DoubleUnitStrategy::DoubleUnitStrategy() {}
    
    double DoubleUnitStrategy::normalize(double n, double max, double min) {
    
        if(this->max_min_inp_val.empty()) {
            this->max_min_inp_val.emplace_back(max);
            this->max_min_inp_val.emplace_back(min);
        } else {
            this->max_min_inp_val.at(0) = max;
            this->max_min_inp_val.at(1) = min;
        }
    
    double DoubleUnitStrategy::de_normalize(double n) {
    
            THROW_RUNTIME_ERROR("Data were not normalized, so de-normalization cannot progress!");
    
        return 0.5 * (1 + (this->get_max_value() - this->get_min_value()) * n) + this->get_min_value();