Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use gradient descent with a learning rate of 0.01. to find the local minima of the function y=(2x+5) starting from the point x=3. At each

Use gradient descent with a learning rate of 0.01. to find the local minima of the function y=(2x+5) starting from the point x=3.

At each step show the point (x, y), the value of the gradient.

Use the following code snippet to get started.

cur_x = 3 rate = 0.01 # Learning rate precision = 0.0000001 #This tells us when to stop the algorithm max_iters = 10000 # maximum number of iterations iters = 0 #iteration counter

cur_x = 3

while iters < max_iters: prev_x= cur_x

cur_x = cur_x - rate * grad(prev_x) #grad returns the gradient

iters = iters+1 #iteration count

Change the code to introduce a required precision. That is to stop when the difference between two consecutive iterations is less than the given precision parameter.

Now use a different function that has local and global minima and experiment with different starting points.

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago