Skip to content
Learn Netverks

Lesson

Step 14/36 39% through track

minimize-multivariate

Multivariate minimization

Last reviewed May 28, 2026 Content v20260528
Track mode
server_script
Means
Server runner
Reading
~1 min
Level
intermediate

This lesson

This lesson teaches Multivariate minimization: SciPy scientific routines on NumPy arrays—statistics, optimization, linear algebra, and numerical methods.

Fitting parameters appears everywhere—from calibration to ML loss minimization.

You will apply Multivariate minimization in contexts like: Research code, engineering simulations, and specialized analytics.

Read the narrative, run NumPy + SciPy snippets in the playground (install scipy and numpy with pip if needed), inspect outputs and convergence, and complete MCQs. Also verify the reported optimum by evaluating the objective nearby.

When you can explain the previous lesson's ideas in your own words.

optimize.minimize handles vector parameters—loss surfaces in ML, calibration of multiple constants, and inverse problems in science and engineering.

Choosing a method

  • BFGS — smooth, unconstrained, gradient approximated
  • Nelder-Mead — derivative-free, slower on high-D
  • L-BFGS-B — large problems with box bounds
  • Provide jac analytic gradient when available for speed

Rosenbrock toy problem

import numpy as np
from scipy import optimize

def rosen(x):
    return sum(100.0 * (x[1:] - x[:-1]**2)**2 + (1 - x[:-1])**2)

x0 = np.array([-1.2, 1.0])
res = optimize.minimize(rosen, x0, method='BFGS')
print(res.x, res.fun)

Diagnostics

Plot loss vs iteration if callback supported; inspect final x and whether constraints were satisfied. Ill-conditioned problems may need scaling of variables.

Important interview questions and answers

  1. Q: Why scale variables?
    A: Optimizers assume similar magnitudes—mixing mm and km hurts convergence.
  2. Q: Nelder-Mead trade-off?
    A: No gradients needed but not ideal for high-dimensional ML losses.

Self-check

  1. Name two minimize methods and when to use each.
  2. What is the Rosenbrock function used for in teaching?

Tip: Scale variables to similar magnitudes before BFGS or L-BFGS-B.

Interview prep

BFGS?

Quasi-Newton for smooth unconstrained—approximates Hessian.

Nelder-Mead?

Derivative-free—slower in high dimensions.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • BFGS idea?
  • Gradient optional?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump