forked from K-miran/HELR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LRtest.h
54 lines (33 loc) · 1.13 KB
/
LRtest.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef LR_UNENC
#define LR_UNENC
#include <NTL/ZZ.h>
#include "Database.h"
#include "../src/CZZ.h" // -> for comparison
using namespace std;
using namespace NTL;
ZZ scaleup(double value, const long& l);
double scaledown(double value, const long& l);
// structure for LRparam
typedef struct LRpar{
int max_iter;
int dim1;
int n_training;
int logn; // log2(n_training)
double coeff[10]; // double coefficients
ZZ evalcoeff[10]; // transformed coefficients for HE
int polyscale;
int log2polyscale;
int polydeg;
long logp;
long nslots;
}LRpar;
void ReadLRparams(LRpar& LRparams, int max_iter, dMat zTrain, int polydeg, long logp);
//---------------------------------------------------------------------
//! @ Plaintext logistic regression
void LR_sigmoid(dVec& theta, dMat zTrain, LRpar& LRparams);
void LR_poly(dVec& theta, dMat zTrain, LRpar& LRparams);
//---------------------------------------------------------------------
double getAUC(dVec theta, dMat zTest);
double getMSE(dVec theta1, dVec theta2);
double getNMSE(dVec theta1, dVec theta2);
#endif