[关闭]
@wujiaju 2020-12-22T06:35:34.000000Z 字数 2122 阅读 466

exp1: Linear Regression and Stochastic Gradient Descent

2020 PostGraduate


You can click here to get the Chinese version.

Motivation of Experiment

  1. Further understand of linear regression 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.

Experiment Step

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 slides.
  5. Calculate gradient toward loss function from each sample.
  6. enote the opposite direction of gradient as .
  7. Update model: , where 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, get the value of as well as .

Finishing experiment report according to experiment result: The template of report can be found in here


Submission

Requirement for Submission

Deadline

P.S.

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