diff --git a/Makefile b/Makefile index 743e186..b60c9b7 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ all : myprogram clean : rm -f *.o myprogram -myprogram : randomness.o activations.o neurons.o network.o training.o main.o +myprogram : randomness.o activations.o neurons.o network.o training.o preprocessing.o main.o gcc -Wall $^ -o myprogram -lm %.o : %.c diff --git a/main.c b/main.c index 044ba9e..52c6c25 100644 --- a/main.c +++ b/main.c @@ -23,11 +23,11 @@ int main(int argc, char *argv[]) float a=5.0; printf("%f\n", (float)exp((double)a));*/ - int n_neurons[] = {15,120,220,120,200,25}; + /*int n_neurons[] = {15,120,220,120,200,25}; char *activations[] = {"relu","relu","relu","relu","relu","relu"}; Network *net = init_network(n_neurons, 6, activations); print_network(net); - destroy_network(net); + destroy_network(net);*/ return 0; } \ No newline at end of file diff --git a/preprocessing.c b/preprocessing.c new file mode 100644 index 0000000..be13870 --- /dev/null +++ b/preprocessing.c @@ -0,0 +1,69 @@ +#include +#include +#include "preprocessing.h" + +Feature *init_feature(float value) +{ + Feature *feature = (Feature*)malloc(sizeof(Feature)); + feature->value = value; + feature->next_feature = NULL; + + return feature; +} + +OneHotLabel *init_onehotlabel(float value) +{ + OneHotLabel *hot = (OneHotLabel*)malloc(sizeof(OneHotLabel)); + hot->value = value; + hot->next = NULL; + + return hot; +} + +Sample *init_sample() +{ + Sample *sample = (Sample*)malloc(sizeof(Sample)); + sample->first_feature = NULL; + sample->first_hot = NULL; + sample->next_sample = NULL; + sample->t = TRAIN; + + return sample; +} + +Data *init_data() +{ + Data *data = (Data*)malloc(sizeof(Data)); + data->first_sample = NULL; + data->last_sample = NULL; + data->size = 0; + + return data; +} + +void destroy_features_from_feature(Feature *feature) +{ + +} + +void destroy_hots_from_hot(OneHotLabel *first_hot) +{ + +} + +void destroy_samples_from_sample(Sample *sample) +{ + +} + +void destroy_data(Data *data) +{ + +} + +Data *csv_to_samples(char *path_to_csv, char *features_separator, float train_percent) +{ + Data *data = init_data(); + //TODO : complete + return data; +} \ No newline at end of file diff --git a/preprocessing.h b/preprocessing.h new file mode 100644 index 0000000..3e3be42 --- /dev/null +++ b/preprocessing.h @@ -0,0 +1,51 @@ +#ifndef PREPROCESSING_H +#define PREPROCESSING_H + +typedef struct feature Feature; +struct feature +{ + float value; + Feature *next_feature; +}; + +typedef struct onehotlabel OneHotLabel; +struct onehotlabel +{ + float value; + OneHotLabel *next; +}; + +typedef enum type Type; +enum type +{ + TRAIN = 0 , TEST = 1 , VALID = 2 +}; + +typedef struct sample Sample; +struct sample +{ + Feature *first_feature; + OneHotLabel *first_hot; + Sample *next_sample; + Type t; +}; + +typedef struct data Data; +struct data +{ + Sample *first_sample; + Sample *last_sample; + int size; +}; + +Feature *init_feature(float value); +OneHotLabel *init_onehotlabel(float value); +Sample *init_sample(); +Data *init_data(); +void destroy_features_from_feature(Feature *feature); +void destroy_hots_from_hot(OneHotLabel *first_hot); +void destroy_samples_from_sample(Sample *sample); +void destroy_data(Data *data); +Data *csv_to_samples(char *path_to_csv, char *features_separator, float train_percent); + +#endif \ No newline at end of file