【问题标题】:Matlab function gradient for fminuncfminunc 的 Matlab 函数梯度
【发布时间】:2011-10-28 03:36:14
【问题描述】:
f = @(w) sum(log(1 + exp(-t .* (phis * w'))))/size(phis, 1) + coef * w*w';
options = optimset('Display', 'notify', 'MaxFunEvals', 2e+6, 'MaxIter', 2e+6);
w = fminunc(f, ones(1, size(phis, 2)), options);
  • phis 大小为 NxN+1
  • t 大小为 Nx1
  • coef 是 const

我正在尝试最小化函数 f,首先我使用的是 fminsearch 但它工作了很长时间,这就是我现在使用 fminunc 的原因,但有一个问题:我需要函数梯度来加速。你能帮我构造函数f的渐变吗,因为我总是收到这个警告:

Warning: Gradient must be provided for trust-region algorithm;
  using line-search algorithm instead.

【问题讨论】:

    标签: algorithm math matlab gradient


    【解决方案1】:

    您正在尝试做的事情称为 逻辑回归,具有 L2 正则化。有比调用 Matlab 函数更好的方法来解决这个问题,因为对数似然函数是凹函数。

    您应该在the statistical website 中提问,或查看my former question there

    【讨论】:

      猜你喜欢
      • 2021-02-06
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      • 2018-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多