aboutsummaryrefslogtreecommitdiff
path: root/src/parse.h
blob: 3f49c155656c09a2b0d5363932596ea75a597167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef PARSE_H
#define PARSE_H

#include <stdio.h>
#include <stdbool.h>

#include "util.h"

enum ArrayType {
    ARRAY_NUMERICAL,
    ARRAY_ORDINAL,
    ARRAY_ONEHOT
};

union ArrayValue {
    double numeric;
    char *categorical;
};

typedef struct Array {
    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
Feel free to download, copy and edit any repo