-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTest.c
73 lines (58 loc) · 1.01 KB
/
Test.c
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "ELM.h"
#ifdef DS_TEST
#include "Test.h"
void RunTest()
{
#ifndef REGRESSION
int predictedLabels[N_TEST];
#else
float predictions[N_TEST];
#endif
int nCorrect = 0;
int i = 0;
int j;
float temp[N_FEATURE];
float* X_t;
for (i = 0; i < N_TEST; i++)
{
for (j = 0; j < N_FEATURE; j++)
{
#ifdef DEBUG
// printf("\n Feature %d = %f ", j, X_test[i][j]);
#endif
temp[j] = X_test[i][j];
}
X_t = preprocess(temp);
#ifdef DEBUG
for (j = 0; j < N_FEATURE; j++)
{
// printf("\n Feature %d after PP = %f ", i, X_t[j]);
}
#endif
#ifndef REGRESSION
{
predictedLabels[i] = (*pClassf)(X_t);
printf("Test %d: Predicted %d Test %d\n", i, predictedLabels[i], y_test[i]);
if (predictedLabels[i] == y_test[i])
{
nCorrect++;
}
}
#else
{
predictions[i] = (*pRegress)(X_t);
}
#endif
}
#ifndef REGRESSION
{
printf("\nClassifier rate: %f\n", (float)nCorrect * 100.0f / (float)N_TEST);
//fflush(stdout);
}
#else
{
//TBD, figure for regression
}
#endif
}
#endif //DS_TEST