Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do in Javascript. Complete the function calc_linLSQ_line(): Use linear least squares to estimate the parameters (a and b) for the following model: (, , )

Do in Javascript.

Complete the function calc_linLSQ_line(): Use linear least squares to estimate the parameters (a and b) for the following model: (, , ) = +

Also, calculate the sum of squared error and include in your report a plot using the parameter values you found. (4 pts)

function calc_linLSQ_line(data) { let N=numeric.dim(data)[0]; //Number of data points let x=squeeze_to_vector(numeric.getBlock(data,[0, 0],[N-1, 0])); //Extract x (dependent) values let y=squeeze_to_vector(numeric.getBlock(data,[0, 1],[N-1, 1])); //Extract y (target) values //Note: x and y are both vectors, use them accordingly. //(For this homework x is a vector, but generally speaking it may not be!)

//Setup matrices/vectors for calculation let A=numeric.rep([N,2],0); //Make an empty (all zero) Nx2 matrix let b=numeric.rep([N],0); //Make an empty N element vector for(let i=0;i

A[i][0]=??; A[i][1]=??; b[i]=??; }

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

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago