Write python code to implement linear regression model

Assignment Help Programming Languages
Reference no: EM131430775

Machine Learning Program: Linear Regression

1 - Program Description

In this programming assignment, you are asked to write python code to implement linear regression model. To test the correctness of your model, you need to apply your linear regression model on two linear regression problems.

The first problem is to predict rental price based on descriptive features of size, floor and, broadband rate. The dataset can be found in prog3.txt, and textbook Table 7.1 (Page 325). You need to do the followings:

1. Using the initial weights given from textbook Table 7.3 (Page 345) to calculate the prediction, error, squared error, erroDelta(D, w[0]), erroDelta(D, w[1]), erroDelta(D, w[2]), erroDelta(D, w[3]). Output the calculations similar to program screenshot in Figure 1, and textbook Table 7.3.

2. Print out the new weights after the _rst iteration of gradient descent algorithm.

3. Using the new weights generated from your algorithm to calculate the prediction, error, squared error, erroDelta(D, w[0]), erroDelta(D, w[1]), erroDelta(D, w[2]), erroDelta(D, w[3]). Output the calculations similar to program screenshot in Figure 1, and textbook Table 7.3.

4. Print out the new weights after the _rst iteration of gradient descent algorithm.

5. Print out the new weights after 100 iterations, and the _nal sum of squared errors.

6. Do the plot between cost function and iterations.

The second problem is to predict oxyen consumption (Column 2) based on descriptive features of age and, heart rate. The dataset can be found in prog3 2.txt, and textbook Page 389. Do the same work as described above, using the initial weights and learning rate from Page 389. You should check your results with the ones provided from the solution manual.

2 - Useful Help

You should not use scikit-learner for this program, but you are allowed to use a slightly modified version of linear regression model (lr house.py) I provide to you, based on online source code.

The online Machine Learning with Python - Linear Regression can be found at https://aimotion.blogspot.com/2011/10/machine-learning-with-python-linear.html.

Read the tutorial and understand how linear regression can be used for predicting house prediction using dataset ex1data2.txt.

You can use the majority of source code for your program, and modify based on that.

The main goal of this program is to understand how the gradient descent algorithm is implemented, and dig into the details of the gradient descent algorithm by printing out errors, deltaErrors for each iteration. You need to pay attention to the usage of dot(), transpose(), matrix addition, matrix multiplication, array cancatenation with numpy.

Text Book - Fundamentals of Machine Learning For Predictive Data Analytics Algorithm, Worked Examples, and Case Studies by John D. Kelleher, Brain Mac Namee and Aoife D'Arcy

Attachment:- Assignment Files.zip

Reference no: EM131430775

Questions Cloud

Are air travel and rail travel substitutes or complements : Are air travel and rail travel substitutes or complements? Is intercity rail travel a normal or an inferior good?
Find a point estimate for the first quartile : The smallest (in weight) 20% of all cowrie-shell earrings are sold at a discount. Find a point estimate for the 20th percentile of the cowrie-shell earring weight distribution.
What environmental characteristics are important to consider : What environmental characteristics are most important to consider? Do you need to consider any processes? Which ones? What concepts or theories discussed in this chapter are most relevant for solving the key problem in this case?
What can we say about its elasticity of demand : If the local bus company raises its price per rider from $2.50 to $2.75 and its total revenues rise, what can we say about its elasticity of demand? What if total revenues fall as a result of the price increase?
Write python code to implement linear regression model : In this programming assignment, you are asked to write python code to implement linear regression model. To test the correctness of your model, you need to apply your linear regression model on two linear regression problems
Find point estimate for maximum pressure developed by pump : Find a point estimate for the minimum pressure developed by this pump.- Find a point estimate for the maximum pressure developed by this pump.
Calculate the price elasticity of demand : Good weather produces a bumper crop of apples. As a result, the price falls from $6 to $3 a basket and the quantity demanded increases from 600 to 1100 baskets a week. Over this price range calculate the price elasticity of demand (using the midpo..
Find a point estimate for the proportion of all bart riders : Let pd denote the difference in population proportions between all BART riders who believe there is enough room for passengers and bikes and all BART riders who believe it is too crowded. Find a point estimate for pd.
Evaluate the significant impact of gender : Examine your own network then describe its diversity in terms of sex, race, ethnicity, and age. Next, based on what you have learned in the course so far, propose three (3) methods you can utilize to broaden or improve your existing network.

Reviews

len1430775

3/17/2017 4:43:01 AM

Topic: linear regression in Python (machine learning). Detailed Question: please find the details in the compressed file. I have also attached the text book as a reference. The topic is covered in chapter 7. You should not use scikit-learner for this program, but you are allowed to use a slightly modified version of linear regression model (lr house.py) I provide to you, based on online source code.

Write a Review

Programming Languages Questions & Answers

  Write down the pseudocode for a program which accepts the

thenbsp bus company charges fares to passengers based on the number of travel zones they cross. additionally discounts

  Application to feature a gui

A program written in Dr. Racket Scheme that makes use of lists, higher order procedures (e.g. map, filter, reduce) and/or recursion. If all of those could be used it would be best

  Write program to compute total payment

Write a program that computes the total payment, tip, and tax for the "ABC" restaurant. This program must have three functions as below: Menu (Show the menu for each customer). Menu include 6 options.

  Implement an advanced scheduler

Implement an advanced scheduler that schedules processes based on their priorities. Each process has a priority, and the scheduler always picks the process with the highest priority.

  Code to sum of all the elements of the array

Write some code that places the sum of all the elements of the array x into total. Declare any variables that you need.

  Write a program that is passed a virtual address

Write a program that is passed a virtual address (in decimal) via the attached txt file and have it output the page number and offset for the given address in the command line.

  Write tax program having single formula to compute tax

Write the tax program with following logic: Set variables cutoff15 and cutoff28 which depend on marital status. Then have single formula which computes tax, depending on incomes and cutoffs.

  Outline and critique how samsung has introduced and

outline and critique how samsung has introduced and developed a holistic system of tqm management and customer focused

  Create constructor by allotting value to gpa attribute

We have provided the super call, which does some of the work of constructor. Your code must complete constructor by allotting value of g to gpa attribute.

  Write a program that reads the data from the file

Write a program that - Reads the data from the file into an array of structure when the form is loaded and When "Display Hits" is clicked, based on the team selected from the list, displays the players from that team and their hits. The players are..

  Create program to determine the median grade

Modify that program to determine the median grade along with the average and the highest and lowest grades

  Explain a script namedmyfind.sh that performs a subset

Write a script namedmyfind.sh that performs a subset of the find command. Your script must handle the following options:-name, -type, -newer, -maxdepth, -mindepth, and-exec

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd