源码:https://github.com/cheesezhe/Coursera-Machine-Learning-Exercise/tree/master/ex5

Introduction:

In this exercise, you will implement regularized linear regression and use it to study models with different bias-variance properties.

1. Regularized Linear Regression

(1). Implement regularized linear regression to predict the amount of water flowing out of a dam using the change of water level in a reservoir;

(2).Go through some diagnostics of debugging learning algorithms and examine the effects of bias v.s. variance;

1.1 Visualizing the dataset

The dataset contains historical records on the change in the water level, x, and the amount of water flowing out of the dam,y.

This dataset is divided into three parts:

  • A training set that your model will learn on:X,y
  • A cross validation set for determining the regularization parameter: Xval, yval
  • A test set for evaluating performance:Xtest, ytest

(1) plot the training data:

Next:

(1) Implement linear regression and use that to fit a straight line to the data and plot learning curves;

(2) Implement polynomial regression to find a better fit to the data;

1.2 Regularized linear regression cost function

Recall that the regularized linear regression has the following cost function:

where λ  is a regularization parameter which controls the degree of regularization(thus, help preventing overfitting). The regularization term puts a penalty on the overal cost J. As the magnitudes of the model paprameters θj increase, the penalty increase as well. Note that you should not regularize the θ0 term.

1.3 Regularized linear regression gradient

Correspondingly, the partial derivative of regularized linear regression's cost for θj is defined as:

the file linearRegCostFunction.m:

function [J, grad] = linearRegCostFunction(X, y, theta, lambda)
%LINEARREGCOSTFUNCTION Compute cost and gradient for regularized linear
%regression with multiple variables
% [J, grad] = LINEARREGCOSTFUNCTION(X, y, theta, lambda) computes the
% cost of using theta as the parameter for linear regression to fit the
% data points in X and y. Returns the cost in J and the gradient in grad % Initialize some useful values
m = length(y); % number of training examples % You need to return the following variables correctly
J = 0;
grad = zeros(size(theta)); % ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost and gradient of regularized linear
% regression for a particular choice of theta.
%
% You should set J to the cost and grad to the gradient.
% %cost function
hx = X*theta;
J = (1/(2*m))*sumsq(hx-y);
reg = lambda/(2*m)*sumsq(theta(2:end));
J = J + reg;
%gradient
% Part 1.3
grad = (X' * (hx-y)) / m;
grad(2:end) += lambda * theta(2:end) / m;
% ========================================================================= grad = grad(:); end

1.4 Fitting linear regression

Once your cost function and gradient are working correctly, the next part is to run the code in trainLinearReg.m to compute the optimal values of θ. This training function uses fmincg to optimize the cost function:

function [theta] = trainLinearReg(X, y, lambda)
%TRAINLINEARREG Trains linear regression given a dataset (X, y) and a
%regularization parameter lambda
% [theta] = TRAINLINEARREG (X, y, lambda) trains linear regression using
% the dataset (X, y) and regularization parameter lambda. Returns the
% trained parameters theta.
% % Initialize Theta
initial_theta = zeros(size(X, 2), 1); % Create "short hand" for the cost function to be minimized
costFunction = @(t) linearRegCostFunction(X, y, t, lambda); % Now, costFunction is a function that takes in only one argument
options = optimset('MaxIter', 200, 'GradObj', 'on'); % Minimize using fmincg
theta = fmincg(costFunction, initial_theta, options); end

In this part, we set regularization parameter λ to zero. Because our current implementation of linear regression is trying to fit a 2-dimensional θ, regularization will not be incredibly helpful for a θ of such low dimension. In the later parts of the exercise, you will be using polynomial regression with regularization.

Finally we will plot the best fit line, resulting in an image similar to Figure 2.

While visualizing the best fit as shown in one possible way to debug your learing algorithm, it is not always easy to visualize the data and model. In the next section, you will implement a function to generate learing curves that can help you debug your learining algorithm even if it is not easy to visualize the data.

2 Bias-variance

An important concept in machine learning is the bias-vairance tradeoff.Models with high bias are not complex enough for the data and tend to underfit,  while models with high variance overfit to the training data.

In this part, we will plot training and test errors on a learning curve to diagnose bias-variance problems.

2.1 Learning curves

A learning curve plots training and cross validation error as a function of training set size. learningCurve.m returns a vector of errors for the training set and cross validation set.

To plot the learning curve, we need a training and cross validation set error for different training set sizes. To obtain different training set sizes, we should use different subsets of the original training set X.

We can use the trainLinearReg function to find  the θ parameters. Note that the lambda is passed as a parameter to the learningCurve function. After learning the θ parameters, we should compute the error on the training and cross validation sets. Recall that the training error for a dataset is defined as:

In particular, note that the training error does not include the regularization term. One way to compute the training error is to use exsiting cost function and set λ to 0 only when using it to compute the training error and cross validation error. When we are computing the training set error, make sure you compute it on the training subset instead of the entire training set. However, for the cross validation error, we should compute it over the entire validation set.

When we are finished, we will see a plot similar to Figure 3.

In Figure 3, we can observe that both the training error and cross validation error are high when the number of training examples is increased. This reflects a high bias problem in the model -- the linear regression is too simple and is unable to fit our dataset well. In the next section, you will implement polynomial regression to fit a better  model for this dataset.

function [error_train, error_val] = ...
learningCurve(X, y, Xval, yval, lambda)
%LEARNINGCURVE Generates the train and cross validation set errors needed
%to plot a learning curve
% [error_train, error_val] = ...
% LEARNINGCURVE(X, y, Xval, yval, lambda) returns the train and
% cross validation set errors for a learning curve. In particular,
% it returns two vectors of the same length - error_train and
% error_val. Then, error_train(i) contains the training error for
% i examples (and similarly for error_val(i)).
%
% In this function, you will compute the train and test errors for
% dataset sizes from 1 up to m. In practice, when working with larger
% datasets, you might want to do this in larger intervals.
% % Number of training examples
m = size(X, 1); % You need to return these values correctly
error_train = zeros(m, 1);
error_val = zeros(m, 1); % ====================== YOUR CODE HERE ======================
% Instructions: Fill in this function to return training errors in
% error_train and the cross validation errors in error_val.
% i.e., error_train(i) and
% error_val(i) should give you the errors
% obtained after training on i examples.
%
% Note: You should evaluate the training error on the first i training
% examples (i.e., X(1:i, :) and y(1:i)).
%
% For the cross-validation error, you should instead evaluate on
% the _entire_ cross validation set (Xval and yval).
%
% Note: If you are using your cost function (linearRegCostFunction)
% to compute the training and cross validation error, you should
% call the function with the lambda argument set to 0.
% Do note that you will still need to use lambda when running
% the training to obtain the theta parameters.
%
% Hint: You can loop over the examples with the following:
%
% for i = 1:m
% % Compute train/cross validation errors using training examples
% % X(1:i, :) and y(1:i), storing the result in
% % error_train(i) and error_val(i)
% ....
%
% end
% % ---------------------- Sample Solution ----------------------
for i = 1:m,
[theta] = trainLinearReg(X(1:i,:),y(1:i),lambda);
error_train(i) = linearRegCostFunction(X(1:i,:),y(1:i),theta,0);
error_val(i) = linearRegCostFunction(Xval,yval,theta,0);
end;
% ------------------------------------------------------------- % ========================================================================= end

3 Polynomial regression

The problem with our linear model was that it was too simple for the data and resulted in underfitting(high bias). In this part of the exercise, we will address this problem by adding more features.

Our hypothesis has the form:

aaarticlea/png;base64,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BAIBALDkC5EIBAIBAKBQECQLkQgEAgEAoFAYBiG/T+Ngk7p32471AAAAABJRU5ErkJggg==" alt="" />

We obtain a linear regression model where the features are the various powers of the original value(waterLevel). Complete the code in polyFeatures.m so that the function maps the original training set X of size m*1 into its higher powers. Specifically, when a training set X of size m*1 is passed into the function, the function should reture a m*p matrix X_poly, where column 1 holds the original values of X, column 2 holds the values of X.^2, column 3 holds the values of X.^3, and so on. Now we have a function that will map features to a higher dimension.

function [X_poly] = polyFeatures(X, p)
%POLYFEATURES Maps X (1D vector) into the p-th power
% [X_poly] = POLYFEATURES(X, p) takes a data matrix X (size m x 1) and
% maps each example into its polynomial features where
% X_poly(i, :) = [X(i) X(i).^2 X(i).^3 ... X(i).^p];
%
% You need to return the following variables correctly.
X_poly = zeros(numel(X), p); % ====================== YOUR CODE HERE ======================
% Instructions: Given a vector X, return a matrix X_poly where the p-th
% column of X contains the values of X to the p-th power.
%
% for i=1:p
X_poly(:,i) = X.^i;
end;
% ========================================================================= end

3.1 Learning Polynomial Regression

Before we are still solving a linear regressino optimization problem.

In this part, we will be using a polynomial of degree 8. It turns out that if we run the training directly on the projected data, will not work well as the features would be badly scaled(e.g., an example with x=40 will now have a feature x8=408=6.5*1012). There fore, we will need to use feature normalization. Call featureNormalize and normalize the features of the training set, storing the mu, sigma parameters separately.

function [X_norm, mu, sigma] = featureNormalize(X)
%FEATURENORMALIZE Normalizes the features in X
% FEATURENORMALIZE(X) returns a normalized version of X where
% the mean value of each feature is 0 and the standard deviation
% is 1. This is often a good preprocessing step to do when
% working with learning algorithms. mu = mean(X);
X_norm = bsxfun(@minus, X, mu); sigma = std(X_norm);
X_norm = bsxfun(@rdivide, X_norm, sigma); % ============================================================ end

After learning the parameters θ, we we see two plots(Figure 4,5) generated for polynomial regression with λ=0.

From Figure 4, we should see that the poly nomial fit is able to follow the datapoints very well - thus, obtaining a low training error. However, the polynomial fit is very complex and even drops off at the extremes. This is an indicator that the polynomial regression model is overfitting the training data and will not generalize well.

Figure 5 shows the same effect where the low training error is low, but the cross validation error is high. There is a gap between the training and cross validation errors, indicating a high variance problem.

One way to combat the overfitting(hight-variance) problem is to add regularization to the model.

3.2 Adjusting the regularization parameter

In this section, we will get to observe how the regularization parameter affects the bias-vairance of regularized polynomial regression. Modify the lambda parameter and try λ=1,100.

For λ=1, we should see a polynomial fit that follows the data trend well(Figure 6) and a learning curve(Figure 7) showing that both the cross validation and training error converge to a relatively low value. This shows the λ=1 regularized polynomial regression model does not have the high bias or high variance problems. In effect, it achieves a good trade-off between bias and variance.

For λ=100, we should see a polynomial fit(Figure 8) that does not follow the data well. In this case, there is too much regularization and the model is unable to fit the training data.

3.3 Selecting λ using a cross validation set

A model without regularization(λ=0) fits the training set well, but does not generalize. Conversely, a model with too much regularization(λ=100) does not fit the training set and testing set well.

We will use a validation set to evaluate how good each λ value is. After selecting the best λ value using the cross validation set, we an then evaluate the model on teh test set to estimate how well the model will perform on actual unseen data.

We should use the trainLinearReg function to train the model using different values of λ and compute the train error and cross validation error. Try λ in the following range:{0,0.001,0.003,0.01,0.03,0.1,0.3,1,3,10}.

validationCurve.m:

function [lambda_vec, error_train, error_val] = ...
validationCurve(X, y, Xval, yval)
%VALIDATIONCURVE Generate the train and validation errors needed to
%plot a validation curve that we can use to select lambda
% [lambda_vec, error_train, error_val] = ...
% VALIDATIONCURVE(X, y, Xval, yval) returns the train
% and validation errors (in error_train, error_val)
% for different values of lambda. You are given the training set (X,
% y) and validation set (Xval, yval).
% % Selected values of lambda (you should not change this)
lambda_vec = [0 0.001 0.003 0.01 0.03 0.1 0.3 1 3 10]'; % You need to return these variables correctly.
error_train = zeros(length(lambda_vec), 1);
error_val = zeros(length(lambda_vec), 1); % ====================== YOUR CODE HERE ======================
% Instructions: Fill in this function to return training errors in
% error_train and the validation errors in error_val. The
% vector lambda_vec contains the different lambda parameters
% to use for each calculation of the errors, i.e,
% error_train(i), and error_val(i) should give
% you the errors obtained after training with
% lambda = lambda_vec(i)
%
% Note: You can loop over lambda_vec with the following:
%
% for i = 1:length(lambda_vec)
% lambda = lambda_vec(i);
% % Compute train / val errors when training linear
% % regression with regularization parameter lambda
% % You should store the result in error_train(i)
% % and error_val(i)
% ....
%
% end
%
% for i = 1:length(lambda_vec),
lambda = lambda_vec(i);
theta = trainLinearReg(X, y, lambda);
error_train(i) = linearRegCostFunction(X, y, theta, 0);
error_val(i) = linearRegCostFunction(Xval, yval, theta, 0);
end; % ========================================================================= end

We should see a plot similar to Figure 9. In this figure, we can see that the best value of λ is around 3. Due to randomness in the training and validation splits of the dataset, the cross validation error can sometimes be lower thatn the training error.

3.4 Computing test set error

To get a better indication of the model's performance in the real world, it is important to evaluate the "final" model on a test set that was not used in any part of training.

3.5 Plotting learning curves with randomly selected examples

In practivce, especially for small training sets, when you polt learning curves to debug your algorithms, it is often helpful to average across multiple sets of randomly selected examples to determin the training error and cross validation error.

Concretely, to determine the training error and cross validation error for i examples, you should first randomly select i examples from the training set and i examples from the cross validation set. We will then learn the parameters θ on the randomly chosen training set and evaluate the parameters θ using the randomly chosen training set and cross validation set. The above steps should then be repeated multiple times and averaged error should be used to determine the training error and cross validation error for i examples.

Figure 10 shows the learning curve we obtained for polynomial regression with λ=0.01.

CheeseZH: Stanford University: Machine Learning Ex5:Regularized Linear Regression and Bias v.s. Variance的更多相关文章

  1. Andrew Ng机器学习 五:Regularized Linear Regression and Bias v.s. Variance

    背景:实现一个线性回归模型,根据这个模型去预测一个水库的水位变化而流出的水量. 加载数据集ex5.data1后,数据集分为三部分: 1,训练集(training set)X与y: 2,交叉验证集(cr ...

  2. 第五次编程作业-Regularized Linear Regression and Bias v.s. Variance

    1.正规化的线性回归 (1)代价函数 (2)梯度 linearRegCostFunction.m function [J, grad] = linearRegCostFunction(X, y, th ...

  3. CheeseZH: Stanford University: Machine Learning Ex3: Multiclass Logistic Regression and Neural Network Prediction

    Handwritten digits recognition (0-9) Multi-class Logistic Regression 1. Vectorizing Logistic Regress ...

  4. CheeseZH: Stanford University: Machine Learning Ex1:Linear Regression

    (1) How to comput the Cost function in Univirate/Multivariate Linear Regression; (2) How to comput t ...

  5. CheeseZH: Stanford University: Machine Learning Ex2:Logistic Regression

    1. Sigmoid Function In Logisttic Regression, the hypothesis is defined as: where function g is the s ...

  6. CheeseZH: Stanford University: Machine Learning Ex4:Training Neural Network(Backpropagation Algorithm)

    1. Feedforward and cost function; 2.Regularized cost function: 3.Sigmoid gradient The gradient for t ...

  7. 机器学习---最小二乘线性回归模型的5个基本假设(Machine Learning Least Squares Linear Regression Assumptions)

    在之前的文章<机器学习---线性回归(Machine Learning Linear Regression)>中说到,使用最小二乘回归模型需要满足一些假设条件.但是这些假设条件却往往是人们 ...

  8. Andrew Ng Machine Learning 专题【Linear Regression】

    此文是斯坦福大学,机器学习界 superstar - Andrew Ng 所开设的 Coursera 课程:Machine Learning 的课程笔记. 力求简洁,仅代表本人观点,不足之处希望大家探 ...

  9. 机器学习---用python实现最小二乘线性回归算法并用随机梯度下降法求解 (Machine Learning Least Squares Linear Regression Application SGD)

    在<机器学习---线性回归(Machine Learning Linear Regression)>一文中,我们主要介绍了最小二乘线性回归算法以及简单地介绍了梯度下降法.现在,让我们来实践 ...

随机推荐

  1. delphi Format格式化函数

    Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用: 首先看它的声明:function Format(const Format: ...

  2. 侏罗纪世界2百度云在线观看迅雷下载高清BT下载

    原名:Jurassic World: Fallen Kingdom 地区:美国 语言:英语 首播:2018-06-15(中国大陆) / 2018-06-22(美国) 电视台: 类型:动作 / 科幻 / ...

  3. JQuery攻略(五)表单验证

    表单验证,字段空白,输入合法,数据合法....... 此章节有 1.1字段验证 1.2正则表达式验证 1.3复选框的勾选 1.1字段验证 1.字段非空 $(document).ready(functi ...

  4. JQuery攻略(二) Jquery手册

    在上一篇 JQuery攻略(一) 基础知识——选择器 与 DOM 中,我写了js的使用,如何选择元素,和一些比较常用的函数及DOM操作. 在这篇中,我将建立多个列表,将更多的 自定义选择器,函数,DO ...

  5. 让java从Mysql返回多个ResultSet

    首先,JDBC对于SQLSERVER来说默认是支持返回,但对于MySql来说,只默认支持存储过程返回多个ResultSet,那对于手写SQL怎么办. 其实很简单,只要一个在连接字符串中加一个参数:al ...

  6. js如何判断用户是在pc端和还是移动端访问

    js如何判断用户是在pc端和还是移动端访问 来源:A5技术交流 作者:wofa 时间:2014-04-25收藏本页 最近一直在忙我们团队的项目“咖啡之翼”,在这个项目中,我们为移动平台提供了一个优秀的 ...

  7. exchange 2010

    Set-MailboxFolderPermission dalian:\Calendar -User Default -AccessRights Reviewer C:\>$rooms = Ge ...

  8. iOS 开发-Certificate、App ID和Provisioning Profile之间的关系

    模拟器调试的时候有的时候不能检验出程序在真实手机上的差别,如果需要进行真机测试或者发布应用到App Store上去的时候, 公司如果没有开发过App,你可以从头开始弄,大部分都是后来接手的,那么当我们 ...

  9. protobuf Protocol Buffers 简介 案例 MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  10. spring boot整合mybatis+mybatis-plus

    Spring boot对于我来说是一个刚接触的新东西,学习过程中,发现这东西还是很容易上手的,Spring boot没配置时会默认使用Spring data jpa,这东西可以说一个极简洁的工具,可是 ...