σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Optimization skill›Module 5 · Optimization in practice›Topic 5.1·~50 minAdvanced

Non-convex pitfalls and restarts

Skill positionModule 5 of 5 · Topic 1 of 2
5.1 Non-convex pitfalls and restarts
—Lab score— / 100Total XP—Streak—

When there is more than one valley

Most interesting models are not convex. Their objectives have several local minima, saddle points and flat plateaus, and gradient descent simply rolls into whichever valley it starts in. Take f(x)=x4−3x2+xf(x)=x^4-3x^2+xf(x)=x4−3x2+x. Its derivative 4x3−6x+14x^3-6x+14x3−6x+1 vanishes at x=−1.301x=-1.301x=−1.301, x=0.170x=0.170x=0.170 and x=1.131x=1.131x=1.131. The first and last are minima with f=−3.514f=-3.514f=−3.514 and f=−1.070f=-1.070f=−1.070, and the middle one is a hump between them. Descent with a small step from x0=2x_0=2x0​=2 ends at 1.1311.1311.131, which is only a local minimum, and from x0=−2x_0=-2x0​=−2 it ends at −1.301-1.301−1.301, the global one. Two starts as close as x0=0.1x_0=0.1x0​=0.1 and x0=0.2x_0=0.2x0​=0.2, on either side of the hump at 0.1700.1700.170, end in different valleys.

f(x)=x4−3x2+x,f′(x)=4x3−6x+1,f(−1.301)=−3.514,f(1.131)=−1.070f(x)=x^{4}-3x^{2}+x,\qquad f'(x)=4x^{3}-6x+1,\qquad f(-1.301)=-3.514,\quad f(1.131)=-1.070f(x)=x4−3x2+x,f′(x)=4x3−6x+1,f(−1.301)=−3.514,f(1.131)=−1.070(1)

Saddle points are the other trap. There the gradient is zero but the Hessian has eigenvalues of both signs, so the function falls in some directions and rises in others. In high dimensions most stationary points are saddles, and plain gradient descent slows to a crawl near them. Momentum, noise from mini-batches and second-order information all help it escape. Plateaus, where the gradient is tiny over a wide region, look like convergence but are not.

The standard remedy is to restart. Run the optimiser from KKK different starting points and keep the result with the lowest objective value. If each start independently lands in the global valley with probability ppp, then at least one of KKK starts does so with probability 1−(1−p)K1-(1-p)^K1−(1−p)K. For p=0.2p=0.2p=0.2 and K=10K=10K=10 this is 0.8930.8930.893, and reaching 99%99\%99% takes K≥ln⁡0.01/ln⁡0.8=20.6K\ge\ln0.01/\ln0.8=20.6K≥ln0.01/ln0.8=20.6, so 21 starts. Better starting points help too: a solution from a convex relaxation, yesterday's calibration, or a grid search over the few parameters that matter most.

  • Local minima: descent ends in the valley where it starts, so the start decides the answer.
  • Saddles and plateaus: zero or tiny gradient without a minimum; momentum and noise help.
  • Restarts: KKK starts succeed with probability 1−(1−p)K1-(1-p)^K1−(1−p)K; keep the best objective value.
A good fit is not a stable fitIn a calibration, several very different parameter sets can reach almost the same objective value. After the restarts, compare not only the best objective but also the parameters across starts and across days. If they jump around while the fit stays equally good, the problem is poorly identified, and a prettier optimiser will not fix it: constrain, regularise or reduce the parameters.

Lab · what's graded

  • The global minimum value15 pts
  • Starting at x = 215 pts
  • Two close starts15 pts
  • Success of random restarts15 pts
  • How many restarts15 pts
  • Near a saddle point10 pts
  • Comparing restart results15 pts
0/ 7 answered
Tasks
1Numeric answer15 ptsNot answered

For f(x)=x4−3x2+xf(x)=x^4-3x^2+xf(x)=x4−3x2+x the global minimum is at x=−1.3008x=-1.3008x=−1.3008. What is fff there? Give it to two decimals.

fglob=fglob =fglob=accepted: ± 0.01
2Choice15 ptsNot answered

Gradient descent with a small step on f(x)=x4−3x2+xf(x)=x^4-3x^2+xf(x)=x4−3x2+x starts at x0=2x_0=2x0​=2. Where does it end?

3Choice15 ptsNot answered

The hump of fff is at x=0.170x=0.170x=0.170. Where do small-step descent runs from x0=0.1x_0=0.1x0​=0.1 and from x0=0.2x_0=0.2x0​=0.2 end?

4Numeric answer15 ptsNot answered

Each random start reaches the global valley with probability p=0.2p=0.2p=0.2, independently. With K=10K=10K=10 starts, what is the probability that at least one succeeds? Give it to three decimals.

psucc=psucc =psucc=accepted: ± 0.002
5Numeric answer15 ptsNot answered

With p=0.2p=0.2p=0.2, what is the smallest number of starts KKK that makes the success probability at least 99%99\%99%?

k=k =k=accepted: ± 0.5
6Choice10 ptsNot answered

Which statement about a saddle point is correct?

7Explain in words15 ptsNot answered

In one or two sentences, say how you choose between the results of several restarts of a calibration, and what else you check.

Math modeKeyboard or LaTeX inputTask 1 of 7 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub