Question: Info for question: Function, solve_neq(X, y) implements Algorithm 1. It should return a Numpy vector containing the model parameter estimates. Steps of the algorithm as

Info for question:

Function, solve_neq(X, y) implements Algorithm 1. It should return a Numpy vector containing the model parameter estimates.

Steps of the algorithm as previously outlined:

  1. Form the Gramian of X, CXTXC
  2. Form bXTy.
  3. Solve C=b for

The algorithm should carry out these steps. For the third step, use Scipy's routine, scipy.linalg.solve(). It has an option that allows you to indicate that CC is symmetric and positive definite, which will be true of CC for our synthetic problem.

The code cell will run your function to compute a set of parameter estimates. It will store these in a variable named theta_neq, which we will refer to later.

Question

Write a function to calculate the residual norm,

Info for question: Function, solve_neq(X, y) implements Algorithm 1. It should return

Although we are minimizing

a Numpy vector containing the model parameter estimates. Steps of the algorithm

your function should return

as previously outlined: Form the Gramian of X, CXTXC Form bXTy. Solve

C=b for The algorithm should carry out these steps. For the third

step, use Scipy's routine, scipy.linalg.solve(). It has an option that allows you

llril2 = 11X0"-ylla. def calc residual norm(X, y, theta): ### YOUR CODE HERE r norm neg -calc residual norm(X, y, theta neg) print("nThe squared residual norm: ", r norm neg) # Test cell: calc residual norm test r norm neg = calc residual norm(X, assert 1e-16

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