-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplicit_example.py
More file actions
32 lines (23 loc) · 886 Bytes
/
Copy pathexplicit_example.py
File metadata and controls
32 lines (23 loc) · 886 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
import numpy as np
inputs = [[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]
weights2 = [[0.1, -0.14, 0.5],
[-0.5, 0.12, -0.33],
[-0.44, 0.73, -0.13]]
biases2 = [-1, 2, -0.5]
layer1_outputs = np.dot(inputs, np.array(weights).T) + biases
layer2_outputs = np.dot(layer1_outputs, np.array(weights2).T) + biases2
print(layer2_outputs)
# layer_outputs = [] # Output of current layer
# for neuron_weights, neuron_bias in zip(weights, biases):
# neuron_output = 0 # Output of given neuron
# for n_input, weight in zip(inputs, neuron_weights):
# neuron_output += n_input*weight
# neuron_output += neuron_bias
# layer_outputs.append(neuron_output)
# print(layer_outputs)