I am trying to learn Neural Network. Following is the code. I am getting the error 'TypeError: Cannot interpret '4' as a data type" Can anyone please help me identifying the mistake?
import numpy as np
inputs = [[1, 2 , 3, 2.5],
[2, 5, 9, 10],
[5, 1, 2, 7],
[3, 2, 1, 4],
[1,1.5, 7, 8]]
class layer_dense:
def __init__ (self, n_inputs, m_neurons):
self.weights= np.random.rand(n_inputs, m_neurons)
self.biases= np.zeros(1, m_neurons)
def forward (self, inputs):
self.output= np.dot(inputs, self.weights)+self.biases
layer1 = layer_dense(4, 4)
layer2 = layer_dense(5,2)
layer1.forward(inputs)
layer2.forward(layer1.output)
print(layer2.output)
Per function description
numpy.zeros(shape, dtype=float, order='C')
The 2nd parameter should be data type and not a number
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With