From 6b2cea33c5a5f2af90eec721ff26c4ff9de468dc Mon Sep 17 00:00:00 2001 From: jvech Date: Sat, 14 Sep 2024 19:46:36 -0500 Subject: feat: onehot feature implementation in process To make onehot available I had to refactor how the data is stored, the current implementation supports json files. --- src/parse.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src/parse.h') diff --git a/src/parse.h b/src/parse.h index 07f740b..3f49c15 100644 --- a/src/parse.h +++ b/src/parse.h @@ -6,13 +6,38 @@ #include "util.h" +enum ArrayType { + ARRAY_NUMERICAL, + ARRAY_ORDINAL, + ARRAY_ONEHOT +}; + +union ArrayValue { + double numeric; + char *categorical; +}; + typedef struct Array { - double *data; + enum ArrayType *type; + union ArrayValue *data; size_t shape[2]; } Array; +void array_free(Array *x); void file_read(char *filepath, Array *input, Array *out, struct Configs configs, bool read_output); void file_write(Array input, Array out, struct Configs ml_configs); char * file_format_infer(char *filename); +double * data_preprocess( + size_t out_shape[2], + Array data, + struct Configs configs, + bool is_input, + bool only_allocate); + +void data_postprocess( + Array *out, + double *data, size_t data_shape[2], + struct Configs cfgs, + bool is_input); #endif -- cgit v1.2.3-70-g09d2