Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a Exercise 1 (10 points) The weights of a neural network are randomly initialized at the beginning of training. There are different ways to initialize
a Exercise 1 (10 points) The weights of a neural network are randomly initialized at the beginning of training. There are different ways to initialize weights. One popular method is called GlorotUniform and it initializes a weight matrix of shape (Nin, Nout) by sampling from a uniform distribution over [-1,7 where 6 nin +nout Implement a function that takes integers n_in, n out as its arguments and returns a pair W and b where W, the weights, is a matrix of shape (n_in, n_out) sampled from the uniform distribution described above and b, the biases, is a zero matrix of shape (1, n out). Hint: np.random.uniform. Don't worry about the fact that this function samples from a half open interval. [ ] def initialize_weights_and_biases(n_in, n out): Initializes the weights and biases Arguments: n_in: int, number of input units nout: int, number of output units Returns: W: The weights, a numpy array of shape (n in, n_out) b: The biases, a numpy array of shape (1, n out) np.random.seed(seed = 1) ########## Your Code goes here ############## ############################################ BB return W, b project_2_tests.test_initialize_weights_and_biases (initialize weights_and_biases)
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