forked from neelabhpant/Deep-Learning-in-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mean_Squared_Error.py
28 lines (20 loc) · 918 Bytes
/
Mean_Squared_Error.py
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
import numpy as np
from sklearn.metrics import mean_squared_error
from Feed_Forward import predict_with_network
weights_0 = {'node_0': np.array([2, 1]),
'node_1': np.array([1, 2]),
'output': np.array([1, 1])}
weights_1 = {'node_0': np.array([2, 1]),
'node_1': np.array([ 1. , 1.5]),
'output': np.array([ 1. , 1.5])}
input_data = [np.array([0, 3]), np.array([1, 2]), np.array([-1, -2]), np.array([4, 0])]
target_actuals = [1, 3, 5, 7]
model_output_0 = []
model_output_1 = []
for row in input_data:
model_output_0.append(predict_with_network(row, weights_0))
model_output_1.append(predict_with_network(row, weights_1))
mse_0 = mean_squared_error(model_output_0, target_actuals)
mse_1 = mean_squared_error(model_output_1, target_actuals)
print("Mean Squared Error with weights_0: %f" %mse_0)
print("Mean Squared Error with weights_1: %f" %mse_1)