TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why Momentum Works (2017)

108 点作者 vector_spaces19 天前

7 条评论

shoo18 天前
I was curious how well the simple momentum step-size approach shown in the first interactive example compares to alternative methods. The example function featured in the first interactive example is named bananaf (&quot;Rosenbrok Function banana function&quot;), defined as<p><pre><code> var s = 3 var x = xy[0]; var y = xy[1]*s var fx = (1-x)*(1-x) + 20*(y - x*x )*(y - x*x ) var dfx = [-2*(1-x) - 80*x*(-x*x + y), s*40*(-x*x + y)] </code></pre> The interactive example uses an initial guess of [-1.21, 0.853] and a fixed 150 iterations, with no convergence test.<p>From manually fiddling with (step-size) alpha &amp; (momentum) beta parameters, and editing the code to specify a smaller number of iterations, it seems quite difficult to tune this momentum-based approach to get near the minima and stay there without bouncing away in 50 iterations or fewer.<p>Out of curiosity, I compared minimising this bananaf function with scipy.optimize.minimize, using the same initial guess.<p>If we force scipy.optimize.minimize to use method=&#x27;cg&#x27;, leaving all other parameters as defaults, it converges to the optimal solution of [1.0, 1.&#x2F;3.] requiring 43 evaluations of fx and dfx,<p>If we allow scipy.optimize.minimize to use all defaults -- including the default method=&#x27;bfgs&#x27;, it converges to the optimal solution after only 34 evaluations of fx and dfx.<p>Under the hood, scipy&#x27;s method=&#x27;cg&#x27; and method=&#x27;bfgs&#x27; solvers do not use a fixed step size or momentum to determine the step size, but instead solve a line search problem. The line search problem is to identify a step size that satisfies a sufficient decrease condition and a curvature condition - see Wolfe conditions [1]. Scipy&#x27;s default line search method -- used for cg and bfgs -- is a python port [2] of the dcsrch routine from MINPACK2. A good reference covering line search methods &amp; BFGS is Nocedal &amp; Wright&#x27;s 2006 book Numerical Optimization.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wolfe_conditions" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Wolfe_conditions</a> [2] <a href="https:&#x2F;&#x2F;github.com&#x2F;scipy&#x2F;scipy&#x2F;blob&#x2F;main&#x2F;scipy&#x2F;optimize&#x2F;_dcsrch.py">https:&#x2F;&#x2F;github.com&#x2F;scipy&#x2F;scipy&#x2F;blob&#x2F;main&#x2F;scipy&#x2F;optimize&#x2F;_dcs...</a>
评论 #43828427 未加载
dang19 天前
Discussed at the time:<p><i>Why Momentum Works</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14034426">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14034426</a> - April 2017 (95 comments)
porridgeraisin19 天前
Distill.pub has such high quality content consistently. It&#x27;s a shame they don&#x27;t seem to be active anymore.
评论 #43825822 未加载
Lerc18 天前
While I&#x27;m interested in the topic of the post and have seen plenty of visualisations of balls rolling around hills, I was a little disappointed that it didn&#x27;t cover the thing that has bugging me for years.<p>Momentum, or specifically inertia, in physics, what the hell is it? There&#x27;s a Feynman tale where he asked his father why the ball rolled to the back of a trolly when he pulled the trolley. The answer he received was the usual description of inertia, but also the rarely given insight that describing something and giving it a name is completely different from knowing why it happens.<p>It&#x27;s one of those things that I lie in bed thinking about. The other one is position, I can grasp the notion of spacetime and the idea of movement and speed as changes in position in space relative to position in time. I really don&#x27;t have a grasp of what position is though. I know the name, I can attach the numbers to it, but that doesn&#x27;t really cover what the numbers are of though.
评论 #43834140 未加载
评论 #43833967 未加载
评论 #43831549 未加载
billfruit18 天前
Perhaps it is an elementary doubt, but does it all apply to rotational motion? Does a wheel rotating along its own axis continue to rotate in perpetuum, in the absense of friction, air resistance etc?
评论 #43836121 未加载
muro18 天前
Only skimped through the article for now, but have to give props to the author - it&#x27;s beautifully made.
timewizard18 天前
Geez. What a dithering article.