-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
29 lines (20 loc) · 791 Bytes
/
start.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
29
import numpy as np
# changed the variable name to X as standard for the input layer in ML
X = [[1, 2, 3, 2.5],
[2.0, 5.0, -1.0, 2.0],
[-1.5, 2.7, 3.3, -0.8]]
weights = [[0.2, 0.8, -0.5, 1.0],
[0.5, -0.91, 0.26, -0.5],
[-0.26, -0.27, 0.17, 0.87]]
biases = [2, 3, 0.5]
# Add a second layer of neuron weights
weights2 = [[0.1, -0.14, 0.5],
[-0.5, 0.12, -0.33],
[-0.44, 0.73, -0.13]]
biases2 = [-1, 2, -0.5]
# Because we are now using a batch of inputs we need to transpose the weights
# so that we dont get a shape error. Note we swapped the dot order too.
layer1_outputs = np.dot(X, np.array(weights).T) + biases
layer2_outputs = np.dot(layer1_outputs, np.array(weights2).T) + biases2
print(layer2_outputs )
# UPTO pt.4 24.05