forked from postgrespro/aqo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmachine_learning.h
32 lines (24 loc) · 974 Bytes
/
machine_learning.h
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
#ifndef MACHINE_LEARNING_H
#define MACHINE_LEARNING_H
/* Max number of matrix rows - max number of possible neighbors. */
#define aqo_K (30)
extern const double object_selection_threshold;
extern const double learning_rate;
#define RELIABILITY_MIN (0.1)
#define RELIABILITY_MAX (1.0)
typedef struct OkNNrdata
{
int rows; /* Number of filled rows in the matrix */
int cols; /* Number of columns in the matrix */
double *matrix[aqo_K]; /* Contains the matrix - learning data for the same
* value of (fs, fss), but different features. */
double targets[aqo_K]; /* Right side of the equations system */
double rfactors[aqo_K];
} OkNNrdata;
extern OkNNrdata* OkNNr_allocate(int ncols);
extern void OkNNr_free(OkNNrdata *data);
/* Machine learning techniques */
extern double OkNNr_predict(OkNNrdata *data, double *features);
extern int OkNNr_learn(OkNNrdata *data,
double *features, double target, double rfactor);
#endif /* MACHINE_LEARNING_H */