cbasedann/preprocessing.c

69 lines
No EOL
1.2 KiB
C

#include <stdio.h>
#include <stdlib.h>
#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;
}