Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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 http://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

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92239557

Have any Question?


Related Questions in Programming Language

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As