Question: answer thsi question:Write a program that answers the following questions. The program must be in . ipynb format, and runnable in Google Colab. In the

answer thsi question:Write a program that answers the following questions. The program must be in .ipynb format, and runnable in Google Colab. In the program use separate code blocks to answer each question. The answers must be printed when the program runs.
Problem - Assume the following nonlinear function. = sin +2 cos2
Prepare a python program to estimate it. Consider the following in your program:
1) Select two hidden layers where the first hidden layer has 6 neurons, and the second hidden layer has 4 neurons.
2) Generate 30 random value for in the range of =[0,] and calculate the correct output of that according to the above equation. Consider these 30 samples as the training data set and train the neural network with these data. Use Mean Square Error for loss function, Adam for optimization and train the NN for 20 epochs.
3) Generate 20 more data points in the range of [0,] for testing the quality of NN. Lets call the correct outputs y. Calculate the prediction of your NN for these values (call them yhat) and compare them with the correct output value y. Plot both y and yhat versus input x at the same figure.
4) Generate 20 more data in the range of [,2] and add them to the test data set generated in step 3. Repeat step 4 and plot y and yhat for the whole test data set. Does your NN have extrapolation capability? (Answer that in a text box appeared after the figure in your program)

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 Programming Questions!