关于Stochastic Gradient Descent和机器学习的优化问题

给定一个问题以及相应的data (z \in Z 是一个sample pair(x,y)),若采用机器学习的手段来解决,那么要分两步走:

1. 模型选择:即选定一族函数 F,这个大F可以是SVM,linear regression,boosting,或者nerual networks(neural network就是一个funciton approximator)等等。

2. 模型参数估计:选定了模型即选定了f_{w}(x)\in F之后, 现在要做的就是通过优化(loss Q(z,w)=l(f_{w}(w), y))的方法解得最优的一组w,从而得到模型 f。

当training set很大时(large scale training),每次优化的update都average (the loss & gradient)over all z in Z太耗时耗资源,因此,就牵扯到利用一个采样得到的样本batch进行一次update。这就引出了expected risk E(f)和empirical risk En(f)的概念:

  • Emprical risk En(f)一个样本batch(n个samples(xi,yi))上的average loss衡量的是模型在训练集上的性能

                                                                      E_{n}(f)=\frac{1}{n}\sum_{i=1}^{n}l(f(x_{i}), y_{i})

  •  Expected risk E(f):整个test set上所有sample的average loss衡量的是模型的generalization能力

                                                                      E(f)=\int l(f(x),y)dP(z)

Vapnik & Chervonenkis的statistical learning theory证明了当模型选择合理时,可以通过优化emprical risk来代替优化expected risk。此处,risk的概念可以理解为average loss

    模型优化---mini-batch GD:在non-convex优化over large scale of data时,Rumelhart et al. 证明了使用gradient descent(GD,此处指的是mini-batch GD(MBGD))优化方法来优化empirical risk的合理性。

而利用GD优化empirical risk又可以分为一阶(first order)GD和二阶(second order)GD:

关于optimization algorithm的order问题:一阶optmization就是只用loss function的一阶deravitives,二阶就是用二阶deravitives(Hessian阵)。那么,当参数量激增的时候,求所有参数的deravitive的代价也增大,而且阶数越高代价增高地越快。所以,高阶优化算法不适用于训练神经网络这样大参数的模型。Newton法就是second order method(with Hessian), 而GD则是一阶方法,GD is relatively efficient optmization methods, since the computation of first-order partial derivatives w.r.t. all the parameters is of the same computational complexity as just evaluating the function.

  • First order GD:

                                                                         w_{t+1}=w_{t}-{\color{Blue} {\color{Green} }\gamma}{\color{Red} \frac{1}{n}\sum_{i=1}^{n}}\nabla_{w}Q(z_{i},w_{t})

\gamma是learning rate,是一个实数。当1. under sufficient regularity assumptions,2. the initial estimate w0 is close enough to the optimum,3. learning rate \gamma is sufficently small,一阶GD能够达到linear convergence:即residual error \rho满足{\color{Red} -log\rho \sim t}.

  • Second prder GD: is a variant of the well known Newton algorithm.

                                                                         w_{t+1}=w_{t}-{\color{Blue} {\color{Green} }\Gamma_{t}}{\color{Red} \frac{1}{n}\sum_{i=1}^{n}}\nabla_{w}Q(z_{i},w_{t})

{\color{Blue} \Gamma_{t}}是一个scaling matrix,它是一个正定矩阵,逼近损失函数在optimum处的Hessian阵的inverse。1. under sufficient regularity assumptions,2. the initial estimate w0 is close enough to the optimum时,二阶GD达到quadratic convergenceresidual error \rho满足{\color{Red} -loglog\rho \sim t}.

    模型优化---Stochastic GD:SGD is a drastic simplication of MBGD, with the "hope" that it can still achieve the performance of BGD/MBGD despite the stochastic sampling noise. 

                                                                             w_{t+1}=w_{t}-{\color{Blue} {\color{Green} }\gamma}\nabla_{w}Q(z_{i},w_{t})

因为SGD的随机性,即随机地按照ground truth distribution地抽取samples,那么SGD相当于直接optimize the expected risk而不是empirical risk


SGD的收敛性需要递减的learning rate满足如下两个条件:

  • \sum_{t}\gamma_{t}=\infty
  • \sum_{t}\gamma_{t}^{2}<\infty

SGD达到最佳收敛速度的前提是learning rate  \gamma _{t} = t^{-1}

 

你可能感兴趣的:(机器学习,SGD)