aboutsummaryrefslogtreecommitdiff
path: root/nnet.h
blob: 81f7574e29ea4d7ba4f116cb8e0ab114d984e2ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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, ...);