Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pogramming Problem: [44 points] In this problem, we write a program to find the coefficients for a linear regression model for the dataset provided (data2.txt).

pogramming Problem: [44 points] In this problem, we write a program to find the coefficients for a linear regression model for the dataset provided (data2.txt). Assume a linear model: y = Wo + wi*x. You need to 1) Plot the data (i.e., X-axis for 1st column, y-axis for 2nd column), and use Python to implement the following methods to find the coefficients: 2) Normal equation, and 3) Gradient Descent using batch AND stochastic modes respectively: a) Determine an appropriate termination condition (e.g., when cost function is less than a threshold, and/or after a given number of iterations). b) Print the cost function vs. iterations for each mode; compare and discuss batch and stochastic modes in terms of the accuracy and the speed of convergence. c) Choose a best learning rate. For example, you can plot cost function vs. learning rate to determine the best learning rate. Please implement the algorithms by yoursef and do NOT use the fit() function of the library. image text in transcribed
3. [44 points] Write a program to find the coefficients for a linear regression model for the dataset provided (data2.txt). Assume a linear model: y=w0+w1x. You need to 1) Plot the data (i.e., x-axis for the 1st column, y-axis for the 2nd column), and use Python to implement the following methods to find the coefficients: 2) Normal equation, and 3) Gradient Descent using batch AND stochastic modes respectively: a) Split dataset into 80% for training and 20% for testing. b) Plot MSE vs. iteration of each mode for both training set and testing set (i.e., batch training and testing; stochastic - training and testing). Compare batch and stochastic modes (with discussion) in terms of accuracy (of testing set) and speed of convergence (You need to determine an appropriate termination condition, e.g., when cost function is less than a threshold, and/or after a given number of iterations.) c) Plot MSE of the testing set vs. learning rate (using 0.001,0.002,0.003,0.004,0.005, 0.006,0.007,0.008,0.009,0.01) and determine the best learning rate. Please implement the algorithms by yourself and do NOT use the fit() function of the library. Applied Machine Learning - CPE 695 @2023 1

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions