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

#ifndef LIB4NEURO_NORMALIZATIONSTRATEGYACSF_H
#define LIB4NEURO_NORMALIZATIONSTRATEGYACSF_H

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

namespace lib4neuro {
    /**
     *
     */
    class NormalizationStrategyACSF : public NormalizationStrategy {
        /**
         * information about the real range of input values for each element
         */
        std::unordered_map<ELEMENT_SYMBOL, std::vector<double> > inputs_min;
        std::unordered_map<ELEMENT_SYMBOL, std::vector<double> > 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;

    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
        );

        NormalizationStrategyACSF(
            const std::vector<ELEMENT_SYMBOL>& element_order,
            std::unordered_map<ELEMENT_SYMBOL, std::vector<double> > inputs_min,
            std::unordered_map<ELEMENT_SYMBOL, std::vector<double> > inputs_max,
            std::unordered_map<ELEMENT_SYMBOL, unsigned int> number_of_inputs_per_element,
            double outputs_min,
            double outputs_max
        ~NormalizationStrategyACSF() override = 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);
        double normalize(double n,
                         double max,
                         double min) override;
        /**
         *
         * @param n
         * @param max
         * @param min
         * @return
         */
        double de_normalize(double n) override;

}//end of namespace lib4neuro

#endif //LIB4NEURO_NORMALIZATIONSTRATEGYACSF_H