구축 방법 — Machine Learning Basics · v1.0 · 2026-10-27
■ 방법
- 탭 5개: Data & Splits / Linear Regression / Classification / Overfitting & Regularization / Evaluation Metrics. 탭마다 개요·체험·요약·참고문헌
- 계산은 모두 브라우저에서: 직접 쓴 JavaScript(ml-core.js), 외부 라이브러리 없음. 사전 학습한 모델 없음
- 나누기: 시드를 정한 무작위 섞기 뒤 학습·검증·시험 비율(기본 60/20/20, 시드 1)
- 선형 회귀: 학습 묶음 평균·표준편차로 표준화, 정규방정식 (XᵀX + λI)w = Xᵀy, 절편은 벌점 없음. 경사하강법 그림은 28일 배합 425개, w/b 하나, 학습률·단계는 사용자가 정함
- 분류: 목표 강도(기본 40 MPa) 이상이면 1. 특징 w/b·log(재령) 둘, 로지스틱 회귀(IRLS, 손실 Σ logloss + λ/2‖w‖², 절편 벌점 없음), 문턱 기본 0.5
- 과적합: 28일 배합에서 학습 점 N개(기본 15)로 w/b의 1–12차 다항식, ridge λ(기본 사실상 0). 검증 100점. '시험 묶음 엿보기'는 서로 다른 섞기 40번에서 학습/검증/시험 오차로 차수를 고른 뒤 남은 배합에서 RMSE를 잰 중앙값
- 지표: RMSE·MAE·R², 혼동행렬·정확도·정밀도·재현율·F1, ROC(모든 문턱)·사다리꼴 AUC, 비교 기준은 평균 찍기·많은 쪽 찍기
- LLM 없음
■ 데이터
- Concrete Compressive Strength (Yeh 1998) · UCI Machine Learning Repository · CC BY 4.0 · DOI 10.24432/C5PK67
- UCI 사이트에 이 작업 환경에서 닿지 않아 같은 파일을 옮겨 둔 GitHub 사본(stedy/Machine-Learning-with-R-datasets, concrete.csv)을 받음. SHA-256을 기록하고, 행 수(1,030)·열 9개·요약 통계를 UCI 설명과 맞춤
- 1,030행 · 특징 8개(시멘트·고로 슬래그·플라이애시·물·고성능 감수제·굵은골재·잔골재 kg/m³, 재령 일) + 압축강도 MPa. 완전히 같은 행 25개(지우지 않고 데이터 탭에서 보여 줌)
- 파생 특징: 물-결합재 비 w/b = 물 ÷ (시멘트 + 슬래그 + 플라이애시), log(재령)
- 준비: python/ml-basics/prepare_concrete.py → src/topics/ml-basics/data/concrete.json
■ 검증
- tests/ml-basics/core-test.mjs가 python/ml-basics/reference.py(scikit-learn 1.9.1 · NumPy 2.5.3 · Python 3.13)의 값과 대조. 분할: 짝수 행 학습, 홀수 행 시험
- 선형 회귀 계수 최대 차이 1.6e-13 · 시험 RMSE 10.206 MPa, R² 0.632
- Ridge λ 10 계수 sklearn Ridge(alpha 10)와 일치
- 로지스틱(C 1 ↔ λ 1) 계수 차이 2.5e-10 · 시험 AUC 0.933, 정확도 0.850, 정밀도 0.822, 재현율 0.767, F1 0.794
- 경사하강법이 최소제곱 해로 수렴함을 확인. 중복 행 25개 확인
- 화면: Playwright로 375·1920px × 한·영 × 탭마다 콘솔 오류·넘침·빈 그림·남은 한글 검사
■ 범위
- 원리를 보이는 교육용 모델이고 콘크리트 배합 설계에 쓰는 도구가 아님. 실제 강도는 시험체로 확인해야 함
■ 출처
- Yeh, I.-C. (1998). Modeling of strength of high-performance concrete using artificial neural networks. Cement and Concrete Research 28(12)
- Hastie, T., Tibshirani, R., Friedman, J. (2009). The Elements of Statistical Learning, 2nd ed. Springer
- James, G. et al. (2021). An Introduction to Statistical Learning, 2nd ed. Springer
- Fawcett, T. (2006). An introduction to ROC analysis. Pattern Recognition Letters 27(8)
- Pedregosa, F. et al. (2011). Scikit-learn: machine learning in Python. JMLR 12
How it's built — Machine Learning Basics · v1.0 · 2026-10-27
■ Method
- 5 tabs: Data & Splits / Linear Regression / Classification / Overfitting & Regularization / Evaluation Metrics. Each tab has an overview, hands-on part, summary and references
- Everything is computed in the browser with hand-written JavaScript (ml-core.js), no external libraries. No pre-trained models
- Splits: seeded random shuffle, then train/validation/test shares (default 60/20/20, seed 1)
- Linear regression: standardised with training-split mean and SD, normal equations (XᵀX + λI)w = Xᵀy, intercept not penalised. The gradient-descent view uses the 425 mixes at 28 days and w/b only; learning rate and steps set by the user
- Classification: label 1 if strength ≥ target (default 40 MPa). Features w/b and log(age), logistic regression (IRLS, loss Σ logloss + λ/2‖w‖², intercept not penalised), default threshold 0.5
- Overfitting: N training points (default 15) from the 28-day mixes, polynomials of w/b of degree 1–12, ridge λ (default effectively 0), 100 validation points. 'Peeking at the test split' picks the degree by training, validation or test error over 40 different shuffles and reports the median RMSE on the remaining mixes
- Metrics: RMSE, MAE, R²; confusion matrix, accuracy, precision, recall, F1; ROC over all thresholds with trapezoidal AUC; baselines predict-the-mean and majority class
- No LLM
■ Data
- Concrete Compressive Strength (Yeh 1998) · UCI Machine Learning Repository · CC BY 4.0 · DOI 10.24432/C5PK67
- The UCI site was not reachable from the build environment, so the same file was taken from a GitHub copy (stedy/Machine-Learning-with-R-datasets, concrete.csv). SHA-256 recorded; row count (1,030), 9 columns and summary statistics checked against the UCI description
- 1,030 rows · 8 features (cement, blast-furnace slag, fly ash, water, superplasticizer, coarse and fine aggregate in kg/m³, age in days) + compressive strength in MPa. 25 exact duplicate rows (kept and shown in the Data tab)
- Derived features: water–binder ratio w/b = water ÷ (cement + slag + fly ash), log(age)
- Preparation: python/ml-basics/prepare_concrete.py → src/topics/ml-basics/data/concrete.json
■ Validation
- tests/ml-basics/core-test.mjs compares against python/ml-basics/reference.py (scikit-learn 1.9.1 · NumPy 2.5.3 · Python 3.13). Split: even rows train, odd rows test
- Linear-regression coefficients max difference 1.6e-13 · test RMSE 10.206 MPa, R² 0.632
- Ridge λ 10 coefficients match sklearn Ridge(alpha 10)
- Logistic (C 1 ↔ λ 1) coefficient difference 2.5e-10 · test AUC 0.933, accuracy 0.850, precision 0.822, recall 0.767, F1 0.794
- Gradient descent converges to the least-squares solution. 25 duplicate rows confirmed
- Screens: Playwright at 375 and 1920 px × Korean/English × every tab, checking console errors, overflow, blank plots and leftover Korean
■ Scope
- Teaching models that show principles; not a tool for designing concrete mixes. Real strength must be confirmed by testing specimens
■ Sources
- Yeh, I.-C. (1998). Modeling of strength of high-performance concrete using artificial neural networks. Cement and Concrete Research 28(12)
- Hastie, T., Tibshirani, R., Friedman, J. (2009). The Elements of Statistical Learning, 2nd ed. Springer
- James, G. et al. (2021). An Introduction to Statistical Learning, 2nd ed. Springer
- Fawcett, T. (2006). An introduction to ROC analysis. Pattern Recognition Letters 27(8)
- Pedregosa, F. et al. (2011). Scikit-learn: machine learning in Python. JMLR 12
■ History
- 2026-10-27 · v1.0 · Released