aboutsummaryrefslogtreecommitdiff
path: root/NNUtils.hpp
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 03:15:03 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 03:15:30 +0100
commit6fd23da97fa9700f59c61a966b4bf7d25fa46b34 (patch)
treed5fe3a8305a5f57e5b4cedc8300e951c74696cc5 /NNUtils.hpp
initial commitHEADmaster
Diffstat (limited to 'NNUtils.hpp')
-rw-r--r--NNUtils.hpp28
1 files changed, 28 insertions, 0 deletions
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 <cmath>
+#include <vector>
+#include <random>
+#include <chrono>
+#include <memory>
+
+enum NodeClass { NEURON, MEMORY_CELL };
+
+enum NeuralNetClass { SINGLE_MLP, DUAL_MLP, SIMPLE_RN, FULLY_RN };
+
+typedef std::vector<float> 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__