id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id
title
category
status
canonical_id
aliases
duplicate_of
source_trust_level
confidence_score
verification_status
tags
raw_sources
last_reinforced
github_commit
tech_stack
wiki-2026-0508-least-squares-methods
Least Squares Methods
10_Wiki/Topics
verified
self
none
A
0.95
applied
optimization
regression
linear-algebra
statistics
2026-05-10
pending
language
framework
python
numpy-scipy
Least Squares Methods
매 한 줄
"매 residual의 제곱합을 최소화하라" . Gauss(1795)와 Legendre(1805)가 독립 발견; 매 modern ML의 MSE loss·linear regression·Kalman filter의 직접 조상이다. 2026에도 매 LoRA fine-tuning의 closed-form initializer로 살아있다.
매 핵심
매 정식화
OLS : minimize ‖y − Xβ‖²; closed-form β̂ = (XᵀX)⁻¹Xᵀy.
Weighted LS : residual에 weight W; β̂ = (XᵀWX)⁻¹XᵀWy.
Total LS : 매 X에도 noise — SVD 기반.
Regularized : Ridge (L2), Lasso (L1), Elastic Net.
매 수치적 안정성
Normal equation 직접 풀이는 매 condition number² 증폭 → QR/SVD 권장.
매 LAPACK gels 는 QR 사용.
매 응용
Linear regression (econometrics, ML baseline).
Curve fitting (lmfit, scipy.optimize.curve_fit).
Bundle adjustment (SLAM, photogrammetry).
Kalman update step (least-squares projection).
💻 패턴
OLS via NumPy (lstsq)
Ridge regression
Nonlinear least squares
QR-based solve (numerically stable)
Weighted LS
Recursive LS (online update)
매 결정 기준
상황
Approach
Well-conditioned, small p
Normal equation
Ill-conditioned
QR or SVD
Many features, sparse
Lasso
Heteroscedastic noise
Weighted LS
Streaming data
RLS
기본값 : np.linalg.lstsq (uses SVD-based GELSD).
🔗 Graph
🤖 LLM 활용
언제 : Linear/affine model fit, baseline regression, calibration curves.
언제 X : Outliers 다수 (use Huber/RANSAC), heavy non-linearity (use NN/GP).
❌ 안티패턴
Normal equation 남용 : 매 ill-conditioned에서 매 silently 망함.
Outlier 무시 : L2 loss는 매 outlier 민감 — robust loss 고려.
Multicollinearity 방치 : VIF 점검 또는 Ridge.
🧪 검증 / 중복
Verified (Trefethen & Bau "Numerical Linear Algebra").
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — OLS/Ridge/RLS patterns