I am trying to know the chance of fire based on sensors x1 and x2.
y=1
For this, I am trying to generate random vectors and matrices for weights and bias but I get an error.
import numpy as np
np.random.seed(seed=123)
w1 = np.random.rand(4,2)
b1 = 4*1
x = np.array([0.4, 0.32])
z1 = np.dot(w1,x) + b1
a1 = 1 / (1+np.exp(-z1))
np.random.seed(seed=123)
w2 = np.random.rand(1,4)
b2 = 1*1
z2 = np.dot(w2,x) + b2
a2 = 1 /(1+np.exp(-z2))
But I get the error below:
----> 1 z2 = np.dot(w2,x) + b2
2 a2 = np.tanh(Z1)
3 print(a2)
ValueError: shapes (2,4) and (2,) not aligned: 4 (dim 1) != 2 (dim 0)
I am not able to figure out how to solve this.