Initial commit

This commit is contained in:
2024-06-22 11:18:56 +02:00
parent eaaec5227c
commit 29cbc53cbc
12 changed files with 628 additions and 0 deletions

17
headers/file.h Normal file
View File

@ -0,0 +1,17 @@
/* See LICENSE file for copyright and license details. */
#ifndef _file_h_
#define _file_h_
typedef struct {
FILE *file;
char *file_name;
} File;
File *new_file(char *file_name);
void free_file(File *f);
double get_entry(File *f, int row, int col, char sep);
int get_columns_num(File *f, int row, char sep);
int get_rows_num(File *f);
#endif

17
headers/layer.h Normal file
View File

@ -0,0 +1,17 @@
/* See LICENSE file for copyright and license details. */
#ifndef _layer_h_
#define _layer_h_
#include "../headers/perceptron.h"
typedef struct {
int p_num;
Perceptron **p;
} Layer;
Layer *new_layer(int p_num, int i_num);
Layer *new_input_layer(int p_num);
void free_layer(Layer *l);
#endif

16
headers/neural_net.h Normal file
View File

@ -0,0 +1,16 @@
/* See LICENSE file for copyright and license details. */
#ifndef _neural_net_h_
#define _neural_net_h_
#include "layer.h"
typedef struct {
int l_num;
Layer **l;
} NeuralNet;
NeuralNet *new_neural_net(char *c_file_name, char *i_file_name);
void free_neural_net(NeuralNet *n);
#endif

15
headers/perceptron.h Normal file
View File

@ -0,0 +1,15 @@
/* See LICENSE file for copyright and license details. */
#ifndef _perceptron_h_
#define _perceptron_h_
typedef struct {
int i_num;
double *weights;
double output;
} Perceptron;
Perceptron *new_perceptron(int i_num);
void free_perceptron(Perceptron *p);
#endif

9
headers/training.h Normal file
View File

@ -0,0 +1,9 @@
/* See LICENSE file for copyright and license details. */
#ifndef _training_h_
#define _training_h_
void train_by_backpropagation(NeuralNet *n, int runs, double t_factor,
char *i_name, char *t_name);
#endif