[关闭]
@liushiya 2018-10-14T02:50:03.000000Z 字数 3390 阅读 3496

Linear Regression and Stochastic Gradient Descent

机器学习 实验


你可以点击这里查看中文版本。

Motivation of Experiment

  1. Further understand of linear regression ,closed-form solution and Stochastic gradient descent.
  2. Conduct some experiments under small scale dataset.
  3. 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.

Environment for Experiment

python3, at least including following python package: sklearnnumpyjupytermatplotlib
It is recommended to install anaconda3 directly, which has built-in python package above.

Submit Deadline

2018-10-28 12:00 AM

Experiment Form

Complete Independently.

Experiment Step

*closed-form solution of Linear Regression *

  1. Load the experiment data. You can use load_svmlight_file function in sklearn library.
  2. 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.
  3. Initialize linear model parameters. You can choose to set all parameter into zero, initialize it randomly or with normal distribution.
  4. Select a Loss function and calculate the value of the Loss function of the training set,denoted as .
  5. Get the formula of the closed-form solution, the process details the courseware ppt.
  6. Get the value of parameter by the closed-form solution, and update the parameter .
  7. Get the under the training set and by validating under validation set.
  8. Output the value of , and .

Linear Regression and Stochastic Gradient Descent

  1. Load the experiment data. You can use load_svmlight_file function in sklearn library.
  2. 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.
  3. Initialize linear model parameters. You can choose to set all parameter into zero, initialize it randomly or with normal distribution.
  4. Choose loss function and derivation: Find more detail in PPT.
  5. Calculate toward loss function from each sample.
  6. Denote the opposite direction of gradient as .
  7. Update model: . is learning rate, a hyper-parameter that we can adjust.
  8. Get the loss under the training set and by validating under validation set.
  9. 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


Any advice or idea is welcome to discuss with teaching assistant in QQ group.

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注