Question

The project consists of two main parts: code and report. Let's beging with the code requirements.

The first part of the code is as follows. Given the following simple dataset, your task is

Simple dataset:

D= [(5, 43.1), (7.1, 32.1), (34.5, 40.3), (13, 39.3), (1.5, 47.7)]

Xnew = [1, 2, 3, 4, 5]

1. Write a function called train to find the best and

. (15 pts)

2. Write a function called predict to make predictions on the Xnew above. (10 pts)

by using the simple dataset D above

3. Write a main function to call the two functions defined above. Print out the parameters Bo

and 3₁, as well as the predictions (a vector Ynew) for Xnew. (15 pts)

4. Remember to use the three-file structure to arrange all your codes. (10 pts)

The second part of the code is as follows. Now, you are given a file 'data.csv". (20 pts)

1. You should not change your predefined two functions.

2. You just need to update your main function to read data from file.

2/n3. Then, you need to write the outputs (model parameters 30 and 3₁, as well as Ynew) to a file

'output.txt' or 'output.csv'. The Ynew is the predictions for the x in the 'test.csv file.

4. More about the 'data.csv' file: the first column is the r and the second column is y.

5. More about the 'test.csv' file: there is only one column, which is the values that needed to

be predicted.

Bonus points

1. Can you plot the data and the line? (10 pts) (No Matlab.)

The second part is about the report. Your report should contain the following sections. (30 pts)

1. Abstract: summary of your result.

2. Introduction: talk about the high-level idea behind your implementations

3. Main Results: give the detailed explanations of your two functions: train and predict.

Also, tell me how to use your functions.

4. Numerical results: present your outputs for the simple dataset, and a snapshot of the output

file. (if you have the bonus plot, also present it in the report)

5. Reflections: present what you have learned through this project.

6. Conclusion: make a concrete conclusion.

Question image 1Question image 2