-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinearRegression.h
More file actions
34 lines (27 loc) · 839 Bytes
/
Copy pathLinearRegression.h
File metadata and controls
34 lines (27 loc) · 839 Bytes
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
#ifndef LR_MODEL_H
#define LR_MODEL_H
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "matrix.h"
#include "vector.h"
typedef long double * data_row;
typedef struct {
char * name;
Vector data;
} Feature;
typedef Feature Output;
typedef struct {
char ** weight_names;
data_row weights;
long weight_count;
bool has_intercept;
} LinearRegression;
LinearRegression * init_model(Feature *feats, long feat_count, bool has_intercept);
void free_model(LinearRegression *model);
LinearRegression * train_model(Feature *feats, Output * output, long feat_count, bool has_intercept);
long double run_model(LinearRegression * model, data_row input);
void save_model(LinearRegression * model, char * file_path);
LinearRegression * load_model(char * file_path);
#endif // LR_MODEL_H