Question: Question: Try to a build a simple optimizer to minimize: f(w)=a[]+a[1]w+a[2]w2++a[d]wd for the coefficients a=[0,0.5,2,,1]. - Plot the function f(w) ( 2 points) - Can
![Question: Try to a build a simple optimizer to minimize: f(w)=a[]+a[1]w+a[2]w2++a[d]wd](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4e397f14ea_07966f4e3979270a.jpg)
Question: Try to a build a simple optimizer to minimize: f(w)=a[]+a[1]w+a[2]w2++a[d]wd for the coefficients a=[0,0.5,2,,1]. - Plot the function f(w) ( 2 points) - Can you see where the minima is? (1 point) - Write a function that outputs f(w) and its gradient ( 3 points). - Run the optimizer on the function to see if it finds the minima (3 poimts). - Print the funciton value and number of iterations (3 points). - Instead of writing the function for a specific coefficient vector create a class that works for an arbitrary vector ( 3 points). You may wish to use the poly. polyval (w,a) method to evaluate the polynomial. import numpy.polynomial.polynomial as poly Question: Try to a build a simple optimizer to minimize: f(w)=a[]+a[1]w+a[2]w2++a[d]wd for the coefficients a=[0,0.5,2,,1]. - Plot the function f(w) ( 2 points) - Can you see where the minima is? (1 point) - Write a function that outputs f(w) and its gradient ( 3 points). - Run the optimizer on the function to see if it finds the minima (3 poimts). - Print the funciton value and number of iterations (3 points). - Instead of writing the function for a specific coefficient vector create a class that works for an arbitrary vector ( 3 points). You may wish to use the poly. polyval (w,a) method to evaluate the polynomial. import numpy.polynomial.polynomial as poly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
