Adding most important features' extraction function
This commit is contained in:
parent
3245044e4e
commit
1a9d81025d
2 changed files with 24 additions and 32 deletions
27
main.c
27
main.c
|
@ -6,22 +6,13 @@
|
|||
#include "network.h"
|
||||
#include "activations.h"
|
||||
#include "training.h"
|
||||
#include "preprocessing.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
init_randomness();
|
||||
|
||||
printf("Bonjour et bienvenu ;)\n");
|
||||
/*int i;
|
||||
for(i=1 ; i<= 30 ; i++)
|
||||
{
|
||||
printf("%dth generated fload = %f\n", i, random_float(0.0 , 1.0));
|
||||
}
|
||||
printf("sigmoid(%f) = %f\n",0.5, sigmoid(0.5));
|
||||
printf("sigmoid_derivative(%f) = %f\n",0.8, sigmoid_derivative(0.8));
|
||||
|
||||
float a=5.0;
|
||||
printf("%f\n", (float)exp((double)a));*/
|
||||
|
||||
/*int n_neurons[] = {15,120,220,120,200,25};
|
||||
char *activations[] = {"relu","relu","relu","relu","relu","relu"};
|
||||
|
@ -29,20 +20,8 @@ int main(int argc, char *argv[])
|
|||
print_network(net);
|
||||
destroy_network(net);*/
|
||||
|
||||
FILE *file = fopen("mydata.csv", "r");
|
||||
char line[100];
|
||||
if(file != NULL)
|
||||
{
|
||||
while(fgets(line, 100, file) != NULL)
|
||||
{
|
||||
//line[strlen(line)-1] = (char)"";
|
||||
printf("%s", line);
|
||||
}
|
||||
fclose(file);
|
||||
}else
|
||||
{
|
||||
printf("Unable to open the file\n");
|
||||
}
|
||||
/*Data *data = csv_to_samples("mydata.csv", ",", 70.0, "yes", 3);
|
||||
destroy_data(data);*/
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "preprocessing.h"
|
||||
|
||||
Feature *init_feature(float value)
|
||||
|
@ -75,21 +76,33 @@ void destroy_data(Data *data)
|
|||
Data *csv_to_samples(char *path_to_csv, char *features_separator, float train_percent, char *apply_onthot_encode, int n_classes)
|
||||
{
|
||||
Data *data = init_data();
|
||||
/*FILE *file;
|
||||
char *chaine;
|
||||
file = fopen(path_to_csv, "r");
|
||||
FILE *file = fopen(path_to_csv, "r");
|
||||
char line[100], *dup;
|
||||
char *token;
|
||||
//float val;
|
||||
if(file != NULL)
|
||||
{
|
||||
while(fgets(chaine, 30, file) != NULL)
|
||||
while(fgets(line, 100, file) != NULL)
|
||||
{
|
||||
printf("%s", chaine);
|
||||
dup = strtok(line, "\n"); //extracting line content without '\n'
|
||||
token = strtok(dup, features_separator);
|
||||
while(token != NULL)
|
||||
{
|
||||
printf("current token = %s\n", token);
|
||||
token = strtok(NULL, features_separator);
|
||||
}
|
||||
printf("----------------\n");
|
||||
}
|
||||
fclose(file);
|
||||
}else
|
||||
{
|
||||
printf("Unable to open the file\n");
|
||||
exit(-1);
|
||||
}
|
||||
}*/
|
||||
//TODO : complete
|
||||
return data;
|
||||
}
|
||||
|
||||
void print_data(const Data *data)
|
||||
{
|
||||
printf("Hello");
|
||||
printf("Hello\n");
|
||||
}
|
Loading…
Reference in a new issue