-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloss.py
More file actions
35 lines (27 loc) · 838 Bytes
/
Copy pathloss.py
File metadata and controls
35 lines (27 loc) · 838 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
35
import numpy as np
def MAE(X, T):
"""Mean Absolute Error
## Output
Loss of the whole mini-batch (one value will be returned)
"""
return np.sum(np.absolute(X-T))/X.shape[0]
def MSE(X, T):
"""Mean Square Error
## Output
Loss of the whole mini-batch (one value will be returned)
"""
return np.sum((X-T)**2)/X.shape[0]
def RMSE(X, T):
"""Root Mean Square Error
## Output
Loss of the whole mini-batch (one value will be returned)
"""
return np.sqrt(np.sum((X-T)**2)/X.shape[0])
def CEL(X, T):
"""Cross Entropy Loss
X: output of softmax function
T: training data in the form of one-hot vector
## Output
Loss of the whole mini-batch (one value will be returned)
"""
return -np.sum(T*np.log(np.absolute(X+10e-7)))/X.shape[0]