Question: Here, we will write a function neural_network, which will apply a neural network operation with 2 inputs and 1 output and a given weight matrix.

Here, we will write a function neural_network, which will apply a neural network operation with 2 inputs and 1 output and a given weight matrix.

Available Functions: You have access to the NumPy python library as np

Your function should take two arguments: inputs and weights, two NumPy arrays of shape (2,1) and should return a NumPy array of shape (1,1), the output of the neural network. Do not forget the tanh activation.

Grader note:: If the grader appears unresponsive and displays Processing", it means (most likely) it has crashed. Please resubmit your answers, and leave a message in the forum and we will work on fixing it as soon as possible.

What I have so far is

def neural_network(inputs,weights): inputs = np.random.rand(2,1) weights = np.random.rand(2,1) result = np.dot(inputs.transpose(),weights) out = np.tan(result) return out raise NotImplementedError

but its wrong, what am I doing wrong?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!