2024-07-06 15:59:22 +00:00
|
|
|
#ifndef NEURAL_H
|
|
|
|
#define NEURAL_H
|
|
|
|
|
|
|
|
typedef struct _neuron {
|
|
|
|
float value;
|
2024-10-12 09:17:52 +00:00
|
|
|
float *weights; // Biases of the neuron towards the next layer,
|
|
|
|
// NULL if output layer
|
2024-07-06 15:59:22 +00:00
|
|
|
} Neuron;
|
|
|
|
|
2024-10-12 09:17:52 +00:00
|
|
|
typedef struct _neural_layer {
|
|
|
|
Neuron *neurons;
|
|
|
|
size_t layer_size; // Neurons Per Layer
|
|
|
|
size_t layer_size_next; // Neurons in next layer, 0 if output layer,
|
|
|
|
} Neural_Layer;
|
|
|
|
|
2024-07-06 15:59:22 +00:00
|
|
|
typedef struct _neural_network {
|
2024-10-12 09:17:52 +00:00
|
|
|
Neural_Layer **layers;
|
|
|
|
ssize_t layer_count;
|
2024-07-06 15:59:22 +00:00
|
|
|
} Neural_Network;
|
|
|
|
|
2024-10-12 09:17:52 +00:00
|
|
|
Neural_Network *neural_new(size_t, size_t, size_t);
|
2024-07-06 15:59:22 +00:00
|
|
|
void neural_randomize(Neural_Network *);
|
|
|
|
float *neural_process(Neural_Network *, float *);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|