-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de8ab2e
commit e5d7976
Showing
3 changed files
with
113 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef NEURAL_H_ | ||
|
||
#include <stdio.h> | ||
#include <unistd.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
#include <fcntl.h> | ||
|
||
typedef struct s_neural t_neural; | ||
struct s_neural | ||
{ | ||
char type;/* input?hidden?output?*/ | ||
double w_sum; | ||
double w_in; | ||
double w_out; | ||
double value; | ||
t_neural *prev; | ||
t_neural *next; | ||
}; | ||
|
||
typedef struct s_layer t_layer; | ||
struct s_layer | ||
{ | ||
t_neural *start; | ||
t_neural *tmp; | ||
t_neural *end; | ||
}; | ||
|
||
typedef struct s_network t_network; | ||
struct s_network | ||
{ | ||
t_layer *input_l; | ||
t_layer *hidden_l; | ||
t_layer *output_l; | ||
}; | ||
|
||
/*PROTOTYPES*/ | ||
/* main.c */ | ||
t_neural *init_node(t_layer *, t_neural *, char); | ||
t_layer *init_layer(int, char); | ||
t_network *init_network(int, int, int, t_network *); | ||
/* print.c */ | ||
void print_layer(t_layer *); | ||
|
||
#endif /*NEURAL_H_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "neural.h" | ||
|
||
void print_layer(t_layer *layer) | ||
{ | ||
t_neural *tmp; | ||
|
||
tmp = layer->start; | ||
while (tmp) | ||
{ | ||
printf("w_in = %f\n", tmp->w_in); | ||
tmp = tmp->next; | ||
} | ||
} |