Skip to content
Snippets Groups Projects
NormalizationStrategyACSF.h 2.26 KiB
Newer Older

#ifndef LIB4NEURO_NORMALIZATIONSTRATEGYACSF_H
#define LIB4NEURO_NORMALIZATIONSTRATEGYACSF_H

#include <limits>
#include <vector>
#include <unordered_map>
#include <serialization/access.hpp>
#include "../SymmetryFunction/SymmetryFunction.h"
#include "../DataSet/DataSet.h"

namespace lib4neuro {
    /**
     *
     */
    class NormalizationStrategyACSF: public NormalizationStrategy {
        friend boost::serialization::access;
        /**
         * information about the real range of input values for each element
         */
        std::unordered_map<ELEMENT_SYMBOL, std::vector<double> > inputs_min, inputs_max;
        /**
        * information about the range of the output
        */
        double outputs_min;
        double outputs_max;
        /**
        * information about the various elements
        */
        std::unordered_map<ELEMENT_SYMBOL, unsigned int > number_of_inputs_per_element;
        std::vector<ELEMENT_SYMBOL> order_of_elements;

        NormalizationStrategyACSF() = default;

    public:

        /**
         *
         */
        struct access;

        NormalizationStrategyACSF(
            const std::unordered_map<ELEMENT_SYMBOL, Element*>& element_description,
            const std::vector<ELEMENT_SYMBOL> &element_order,
            const std::vector<std::pair<std::vector<double>, std::vector<double>>> &data
        );

        virtual ~NormalizationStrategyACSF( ) = default;


        void normalize_input(std::vector<double> &inp);

        void de_normalize_input(std::vector<double> &inp);

        void normalize_output(std::vector<double> &out);

        void de_normalize_output(std::vector<double> &out);

        /**
         *
         * @param n
         * @param max
         * @param min
         * @return
         */
        virtual double normalize(double n,
                                 double max,
                                 double min){
                                     return 0.0;
                                 };
        /**
         *
         * @param n
         * @param max
         * @param min
         * @return
         */
        virtual double de_normalize(double n){
            return 0.0;
        }
    };

}//end of namespace lib4neuro

#endif //LIB4NEURO_NORMALIZATIONSTRATEGYACSF_H