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 a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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