Further understand of linear regression ,closed-form solution and Stochastic gradient descent.
Conduct some experiments under small scale dataset.
Realize the process of optimization and adjusting parameters.
Dataset
Linear Regression uses Housing in LIBSVM Data, including 506 samples and each sample has 13 features. You are expected to download scaled edition. After downloading, you are supposed to divide it into training set, validation set.
Load the experiment data. You can use load_svmlight_file function in sklearn library.
Devide dataset. You should divide dataset into training set and validation set using train_test_split function. Test set is not required in this experiment.
Initialize linear model parameters. You can choose to set all parameter into zero, initialize it randomly or with normal distribution.
Select a Loss function and calculate the value of the Loss function of the training set,denoted as .
Get the formula of the closed-form solution, the process details the courseware ppt.
Get the value of parameter by the closed-form solution, and update the parameter .
Get the , under the training set and by validating under validation set.
Output the value of , and .
Linear Regression and Stochastic Gradient Descent
Load the experiment data. You can use load_svmlight_file function in sklearn library.
Devide dataset. You should divide dataset into training set and validation set using train_test_split function. Test set is not required in this experiment.
Initialize linear model parameters. You can choose to set all parameter into zero, initialize it randomly or with normal distribution.
Choose loss function and derivation: Find more detail in PPT.
Calculate toward loss function from each sample.
Denote the opposite direction of gradient as .
Update model: . is learning rate, a hyper-parameter that we can adjust.
Get the loss under the training set and by validating under validation set.
Repeate step 5 to 8 for several times, andand output the value of as well as .
Finishing experiment report according to result: The template of report can be found in example repository.
Evaluation
Item
Proportion
Description
Attendance
40%
Ask for a leave if time conflict
Code availability
20%
Complied successfully
Report
30%
According to report model
Code specification
10%
Mainly consider whether using the readable variable name
Requirement for Submission
Submission process
1.Access222.201.187.50:7001.
2.Click on the corresponding submission entry.
3.Fill in your name, student number, upload pdf format report and zip format code compression package.
Precautions
Experiment reports and code can be uploaded multiple times, and multiple uploads will overwrite previously submitted files.
After uploading, you can refresh the page and check if the upload is successful in the file list below.
Teaching assistants save all uploaded results at the experimental deadline, and the files uploaded after the deadline are invalid.
If you write an experiment report in Word, you need to export it to pdf format.
The package format of the code file must be zip. Please do not submit the compressed file in rar format.
Submit URL can only be accessed by campus network.
The code is written in python language, the experimental report score standard English is better than Chinese, latex is better than word.
Any advice or idea is welcome to discuss with teaching assistant in QQ group.