-
Notifications
You must be signed in to change notification settings - Fork 4
/
loss.c
46 lines (37 loc) · 990 Bytes
/
loss.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
#include "popc.h"
#include "loss.h"
loss ptr lossNew (lossFunctionType lft) {
loss ptr lf = (loss ptr) malloc ( sizeof (loss));
dbcEnsure (lf != NULL, "Memory Allocation Error!");
lf -> lft = lft;
switch (lft) {
case lftActualError:
lf -> lossTransferFunction = lossActualError;
lf -> lossTransferFunctionPrime = lossActualErrorPrime;
break;
default:
dbcRequire (false, "Unknown actionvation function parameter in lossNew ().");
}
return lf;
}
void lossDel (loss ptr lf) {
free (lf);
}
double lossActualError (double t, double o) {
return (t - o);
}
double lossActualErrorPrime (double t, double o) {
// PENDING
dbcAssert (false, "[PENDING] Not Implemented");
return 0 * t * o;
}
double lossMeanAbsoluteError (double t, double o) {
// PENDING
dbcAssert (false, "[PENDING] Not Implemented");
return (t - o);
}
double lossMeanAbsoluteErrorPrime (double t, double o) {
// PENDING
dbcAssert (false, "[PENDING] Not Implemented");
return t - o;
}