Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
QBUS2820 Predictive Analytics
Assignment 1
Key information
Required submissions: Written report (word or pdf format, through Turnitin submission),
predictions for the test data (through Kaggle), and Jupyter Notebook (through Ed). Group
leader needs to submit the Written report and Jupyter Notebook.
Due date: Monday 24th September 2018, 2pm (report and Jupyter notebook submission.
Kaggle competition closure). The late penalty for the assignment is 10% of the assigned
mark per day, starting after 2pm on the due date. The closing date Monday 1st October
2018, 2pm is the last date on which an assessment will be accepted for marking.
Note the due date is extended compared to the one in the UoS outline, to release your
pressure and avoid you have mid-exam and assignment 1 due date on the same day. The
mid-exam date is centralized by the Uni which is not controlled by the unit coordinator. If
you are planning to take a holiday during the Uni common vacation week, please start your
assignment work earlier and make sure you meet the required timeline.
Weight: 20 out of 100 marks in your final grade.
Groups: You can complete the assignment in groups of up to three students. There are no
exceptions: if there are more than three you need to split the group.
Length: The main text of your report (including Task 1 and Task 2) should have a
maximum of 15 pages. Especially for Task 2, you should write a complete report including
sections such as business context, problem formulation, data processing, EDA, and feature
engineering, methodology, analysis, conclusions and limitations, etc.
If you wish to include additional material, you can do so by creating an appendix. There is
no page limit for the appendix. Keep in mind that making good use of your audience’s time
is an essential business skill. Every sentence, table and figure has to count. Extraneous
and/or wrong material will reduce your mark no matter the quality of the assignment.
Anonymous marking: As the anonymous marking policy of the University, please only
include your student ID and group ID in the submitted report, and do NOT include your
name. The file name of your report should follow the following format. Replace "123" with
your group SID. Example: Group123Qbus2820Assignment1S22018.
Presentation of the assignment is part of the assignment. Markers might assign up to 10%
of the mark for clarity of writing and presentation. Numbers with decimals should be
reported to the third decimal point.
Key rules:
? Carefully read the requirements for each part of the assignment.
? Please follow any further instructions announced on Canvas, particularly for submissions.
? You must use Python for the assignment.
? Reproducibility is fundamental in data analysis, so that you will be required to submit a
Jupyter Notebook that generates your results. Unfortunately, Turnitin does not accept
multiple files, so that you will do this through Ed instead. Not submitting your code will
lead to a loss of 50% of the assignment marks.
? Failure to read information and follow instructions may lead to a loss of marks.
Task 1 (20 Marks)
Instructions
You will work on the Boston housing dataset.
Use "random_state= 1" when needed, e.g. when using “train_test_split” function of Python.
For all other parameters that are not specified in the questions, use the default values of
corresponding Python functions.
Suppose you are interested in using the house AGE (proportion of owner-occupied units built
prior to 1940) as the first feature ???? and the full-value property-tax rate TAX as the second
feature ????, to predict the median value of owner-occupied homes in $1000’s as the target y.
Write code to extract these two features and the target from the dataset.
(a) (5 marks) Before doing the regression, you would like to visualize the loss function to get
a rough idea of the potential optimal values of the parameters. Use two chosen features
and the target as the new dataset to plot the loss function (MSE):
??(??) =
1
??
∑(???? ? ???(????))
2
??
??=1
with ???(????) = ???
1????1 + ???
2????2
That is, we are using a linear regression model without the intercept term ??0. Hint:
This is a 3D plot and you will need to iterate over a range of ??1 and ??2 values.
(b) (10 marks) Based on slides from 27 to 32 of lecture 5, write your own Gradient Ascend
algorithm (you may build your solution based on the template of tutorial 6 task), to
estimate the parameters of the given regression problem without the intercept.
? Find the approximate range of acceptable learning rates and explain why some
learning rates are defective.
? Find the optimal learning rate in this range and explain why this is the optimal
value.
Use ?? = [0,0]
??
as your initialization point.
(c) (5 marks) For this task, you can use the linear regression model LinearRegression in the
scikit-learn package.
Use “train_test_split” function to split 80% of the data as your training data, and the
remaining 20% as your testing data. Construct the centred training dataset by conducting
the following steps in Python based on the training data:
(i) Calculate the mean of all the target values, then deduct this mean from each of
target values. Take the resulting target values as the new target values ????????;
(ii) Calculate the mean of all the first feature values, then deduct this mean from
each of first feature values. Take the result as the new first feature ??1??????;
(iii) Do the same for the second feature. The result is ??2??????;
Now build linear regression, with and without the intercept respectively, to fit to the new
data ??1??????, ??2?????? and ????????. Report and compare the coefficients and the intercept.
Compare the predictive performance (using MSE) of two models over the testing data.
Note that, when you take your testing data into the model to calculate predictive
performance scores, you should transform the testing features and targets.
Task 2 (40 Marks)
Moneyball
You will work on the NBA salary dataset.
Note: This task does not require prior knowledge of basketball. You should not add any
personal subjective assumptions about the data based on your existing knowledge, e.g.
deciding which variables are important for the salary prediction. This can lead to inaccurate
results. You should use the techniques that we learnt and you discovered to get good models
and complete the prediction task.
1. Problem description
Find the most appropriate predictive models of your choice to predict NBA player
salary from performance statistics.
As a consultant working for a sports data analytics company, the NBA league approached
you to develop predictive models to predict NBA salaries based on state-of-art techniques
from predictive analytics. To enable this task, you were provided with a dataset containing
highly detailed performance of the NBA players. The response is the SALARY($Millions)
column in the dataset.
As part of the contract, you need to write a report according to the details below. The client
will use a test set to evaluate your work.
2. Getting the data
Kaggle competition: you need to create a Kaggle account based on your university e-mail
address in order to have access and make submissions. Under Kaggle “Team” page, you can
form teams on Kaggle, and the team must have the same group members as in Canvas. The
group leader should create a team on Kaggle which must use the Canvas group ID as the
team name, e.g. Group 16. The team leader can then invite your team members. Then all
group members should be able to submit prediction results.
The scoring metric is: Root Mean Square Error (RMSE).
The maximum submission per day is 10.