Sale!

Assignment 2 Simple linear regression

Original price was: $35.00.Current price is: $29.00.

Rate this product

CSCI 362: Machine Learning Assignment 2
Simple linear regression
Consider the point cloud in the xy-plane consisting of the 60 blue points pictured below.
The data determining the points is contained in the csv (comma separated values) file assign2.csv which
you can download from Canvas.
Download assign2.csv to your working directory for this assignment and have a look at its contents.
The following code will read the data from assign2.csv into torch tensors.
import torch
import csv
with open(‘assign2.csv’) as csvfile:
reader = csv.reader(csvfile, delimiter=’,’)
next(csvfile) # skip the first line
xs, ys = [], []
for row in reader:
xs.append(float(row[0]))
ys.append(float(row[1]))
xs, ys = torch.tensor(xs), torch.tensor(ys)
Finish this assignment by adding code to the program above to compute and print the slope and intercept
of the least squares regression line — the red line in the graphic above.
Include a screenshot of your program and its output in your solution document.

Reviews

There are no reviews yet.

Be the first to review “Assignment 2 Simple linear regression”

Your email address will not be published. Required fields are marked *

Scroll to Top