-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevaluation.py
More file actions
35 lines (32 loc) · 887 Bytes
/
evaluation.py
File metadata and controls
35 lines (32 loc) · 887 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 model_evaluation(data):
SSR_model = sum(
(
np.array(data.prediction).reshape(data.shape[0], 1)
- np.array(data.solar).reshape(data.shape[0], 1)
)
** 2
)
MSE = SSR_model / data.shape[0]
T = len(data)
top = sum(
abs(
np.array(data.prediction).reshape(data.shape[0], 1)
- np.array(data.solar).reshape(data.shape[0], 1)
)
)
bottom = sum([abs(i - j) for i, j in zip(data.solar, data.solar[1:])])
MASE = (T - 1) / T * top / bottom
top = np.sqrt(
sum(
(
np.array(data.prediction).reshape(data.shape[0], 1)
- np.array(data.solar).reshape(data.shape[0], 1)
)
** 2
)
/ T
)
bottom = data.solar.mean()
CV = top / bottom
return MSE, MASE, CV