Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed

Although we are minimizing

image text in transcribed

your function should return

image text in transcribed

image text in transcribed

image text in transcribed

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

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

Students also viewed these Databases questions