Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 8 (10 points) - y_hat = + Code + Text # TODO: Calculate the predictions of the model on batch_x y_hat = [] >

image text in transcribed

image text in transcribedimage text in transcribed

Exercise 8 (10 points) - y_hat = + Code + Text # TODO: Calculate the predictions of the model on batch_x y_hat = [] > # TODO: Find the mean squared error for y_hat and batch_y and append the # result to the losses list. loss = # TODO: Update the parameters. weights, biases = ######################################################## losses.append(np.sqrt(loss)) avg_loss.append(np.mean(losses)) y_hat = forward_pass(x_test, weights, biases) val_loss = np.sqrt(mean_squared_error(y_hat, y_test)) val_losses.append(val_loss) print("Epoch %i, Validation loss %f, Training loss %f" %(epoch, val_loss, np.mean(losses ))) plt.plot(val_losses, label = "Validation loss") plt.plot(avg_loss, label = "Training loss") plt.ylabel('Loss') plt.xlabel('Epochs') plt.legendo plt.title("Learning rate =" + str(learning rate) + " Batch size =" + str(batch_size)) plt.show [ ] Weights, biases Let's see how the model is doing by comparing the predictions of the model and the labels for the first 10 data points in the test set. [] forward_pass(x_test[:10), weights, biases) [] y_test[:10] [] Exercise 8 (10 points) - y_hat = + Code + Text # TODO: Calculate the predictions of the model on batch_x y_hat = [] > # TODO: Find the mean squared error for y_hat and batch_y and append the # result to the losses list. loss = # TODO: Update the parameters. weights, biases = ######################################################## losses.append(np.sqrt(loss)) avg_loss.append(np.mean(losses)) y_hat = forward_pass(x_test, weights, biases) val_loss = np.sqrt(mean_squared_error(y_hat, y_test)) val_losses.append(val_loss) print("Epoch %i, Validation loss %f, Training loss %f" %(epoch, val_loss, np.mean(losses ))) plt.plot(val_losses, label = "Validation loss") plt.plot(avg_loss, label = "Training loss") plt.ylabel('Loss') plt.xlabel('Epochs') plt.legendo plt.title("Learning rate =" + str(learning rate) + " Batch size =" + str(batch_size)) plt.show [ ] Weights, biases Let's see how the model is doing by comparing the predictions of the model and the labels for the first 10 data points in the test set. [] forward_pass(x_test[:10), weights, biases) [] y_test[:10] []

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Presentations Approaches to Conveying Information

Answered: 1 week ago