aboutsummaryrefslogtreecommitdiff
path: root/nnet.h
diff options
context:
space:
mode:
authorSoikk2022-08-23 13:37:28 +0200
committerSoikk2022-08-23 13:37:28 +0200
commitc5aa7ab9060263d0e626b241a7269649a0403a63 (patch)
treeca7755607aabf58ba999bfb9ea741cf2bb5d5ac3 /nnet.h
parent5f54e35503ec4483d73c30f904fbbb5fc7d628e5 (diff)
downloadsoikk-nnet-c5aa7ab9060263d0e626b241a7269649a0403a63.tar.xz
soikk-nnet-c5aa7ab9060263d0e626b241a7269649a0403a63.tar.zst
Reorganized nnet
Diffstat (limited to 'nnet.h')
-rw-r--r--nnet.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/nnet.h b/nnet.h
new file mode 100644
index 0000000..81f7574
--- /dev/null
+++ b/nnet.h
@@ -0,0 +1,69 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <math.h>
+#include <time.h>
+
+
+typedef enum{
+ LINEAR,
+ SIGMOID,
+} functions;
+
+typedef struct{
+ double weight;
+ double data;
+} branch;
+
+typedef struct{
+ functions function;
+ int size;
+ branch *branches;
+ double bias;
+ double out;
+} neuron;
+
+typedef struct{
+ int size;
+ neuron **neurons;
+} layer;
+
+typedef struct lnode{
+ layer layer;
+ struct lnode *next;
+} lnode;
+
+typedef struct{
+ int layers;
+ lnode *head;
+} net;
+
+
+double drand(double high, double low);
+
+branch createBranch(double weight, double data);
+
+neuron *createNeuron(double bias, functions function, int size, ...);
+
+void addBranch(neuron *n, double weight);
+
+void addBranches(neuron *n, int size, double *data);
+
+void changeFunction(neuron *n, functions function);
+
+int changeWeight(neuron *n, int pos, double weight);
+
+int inputNeuron(neuron *n, int pos, double data);
+
+double rawValue(neuron *n);
+
+double outputNeuron(neuron *n);
+
+layer createLayer(int size, ...);
+
+net createNet(int layers, ...);
+
+double *propagateLayer(layer *l, int size, double *data);
+
+double *propagate(net *nt, ...);