From 6fd23da97fa9700f59c61a966b4bf7d25fa46b34 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 03:15:03 +0100 Subject: initial commit --- NNUtils.hpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 NNUtils.hpp (limited to 'NNUtils.hpp') diff --git a/NNUtils.hpp b/NNUtils.hpp new file mode 100644 index 0000000..e2c12ba --- /dev/null +++ b/NNUtils.hpp @@ -0,0 +1,28 @@ +#ifndef __NNUTILS_HPP__ +#define __NNUTILS_HPP__ + +#include +#include +#include +#include +#include + +enum NodeClass { NEURON, MEMORY_CELL }; + +enum NeuralNetClass { SINGLE_MLP, DUAL_MLP, SIMPLE_RN, FULLY_RN }; + +typedef std::vector Chromosome; + +void seedRand(); + +float realRand(float low, float hi); + +int intRand(int low, int hi); + +float sigmoid(float input, float sensitivity = 1.f); + +void crossover(const Chromosome &parent, const Chromosome &mother, Chromosome &child1, Chromosome &child2); + +void mutate(Chromosome &chromosome, float mutationRate = 0.001f); + +#endif // __NNUTILS_HPP__ -- cgit v1.2.1