Improving preprocessing functions
This commit is contained in:
parent
1a9d81025d
commit
b003e51538
3 changed files with 11 additions and 4 deletions
2
main.c
2
main.c
|
@ -20,7 +20,7 @@ int main(int argc, char *argv[])
|
|||
print_network(net);
|
||||
destroy_network(net);*/
|
||||
|
||||
/*Data *data = csv_to_samples("mydata.csv", ",", 70.0, "yes", 3);
|
||||
/*Data *data = csv_to_samples("mydata.csv", 3, ",", 70.0, "yes", 3);
|
||||
destroy_data(data);*/
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -42,6 +42,13 @@ Data *init_data()
|
|||
return data;
|
||||
}
|
||||
|
||||
void add_sample_to_data(Data *data, Sample *sample)
|
||||
{
|
||||
data->last_sample->next_sample = sample;
|
||||
data->last_sample = sample;
|
||||
data->size++;
|
||||
}
|
||||
|
||||
void destroy_sample(Sample *sample)
|
||||
{
|
||||
Feature *temp1;
|
||||
|
@ -73,7 +80,7 @@ void destroy_data(Data *data)
|
|||
free(data);
|
||||
}
|
||||
|
||||
Data *csv_to_samples(char *path_to_csv, char *features_separator, float train_percent, char *apply_onthot_encode, int n_classes)
|
||||
Data *csv_to_samples(char *path_to_csv, int n_features, char *features_separator, float train_percent, char *apply_onthot_encode, int n_classes)
|
||||
{
|
||||
Data *data = init_data();
|
||||
FILE *file = fopen(path_to_csv, "r");
|
||||
|
|
|
@ -42,10 +42,10 @@ Feature *init_feature(float value);
|
|||
OneHotLabel *init_onehotlabel(float value);
|
||||
Sample *init_sample();
|
||||
Data *init_data();
|
||||
void add_sample_to_data(Data *data, Sample *sample);
|
||||
void destroy_sample(Sample *sample);
|
||||
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 *csv_to_samples(char *path_to_csv, char *features_separator, float train_percent);
|
||||
Data *csv_to_samples(char *path_to_csv, int n_features, char *features_separator, float train_percent, char *apply_onthot_encode, int n_classes);
|
||||
void print_data(const Data *data);
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue