# download the software import urllib urllib.urlretrieve('https://github.com/sods/ods/archive/master.zip', 'master.zip') # unzip the software import zipfile zip = zipfile.ZipFile('./master.zip', 'r') for name in zip.namelist(): zip.extract(name, '.') # add the module location to the python path. import sys sys.path.append("./ods-master/") import numpy as np import pods data = pods.datasets.olympic_marathon_men() x = data['X'] y = data['Y'] %matplotlib inline import pylab as plt plt.plot(x, y, 'rx') #### Question 1 Answer Code # Write code for you answer to this question in this box # Do not delete these comments, otherwise you will get zero for this answer. # Make sure your code has run and the answer is correct *before* submitting your notebook for marking. #### Question 2 Answer Code # Write code for you answer to this question in this box # Do not delete these comments, otherwise you will get zero for this answer. # Make sure your code has run and the answer is correct *before* submitting your notebook for marking. # select indices of data to 'hold out' indices_hold_out = np.flatnonzero(x>1980) # Create a training set x_train = np.delete(x, indices_hold_out, axis=0) y_train = np.delete(y, indices_hold_out, axis=0) # Create a hold out set x_valid = np.take(x, indices_hold_out, axis=0) y_valid = np.take(y, indices_hold_out, axis=0) #### Question 3 Answer Code # Write code for you answer to this question in this box # Do not delete these comments, otherwise you will get zero for this answer. # Make sure your code has run and the answer is correct *before* submitting your notebook for marking. #### Question 4 Answer Code # Write code for you answer to this question in this box # Do not delete these comments, otherwise you will get zero for this answer. # Make sure your code has run and the answer is correct *before* submitting your notebook for marking. train_err #### Question 5 Answer Code # Write code for you answer to this question in this box # Do not delete these comments, otherwise you will get zero for this answer. # Make sure your code has run and the answer is correct *before* submitting your notebook for marking. #### Question 6 Answer Code # Write code for you answer to this question in this box # Do not delete these comments, otherwise you will get zero for this answer. # Make sure your code has run and the answer is correct *before* submitting your notebook for marking.