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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started