initial commit FESurrogateModelTutorial

This commit is contained in:
김경종
2026-05-21 17:03:51 +09:00
parent 93665d9ee6
commit 43b86669fa
122 changed files with 7929 additions and 0 deletions
@@ -0,0 +1,76 @@
# Random Forest Surrogate
## 핵심 아이디어
Random Forest는 여러 decision tree를 bootstrap sample로 학습하고 평균하여 예측하는 ensemble 모델이다. 각 tree는 입력 공간을 여러 영역으로 나누고, 회귀 문제에서는 leaf의 평균값을 예측한다.
```text
\hat{f}(x) = (1 / T) sum_{t=1}^{T} h_t(x)
```
- `T`: tree 개수.
- `h_t`: 개별 regression tree.
Breiman의 2001년 Random Forest 논문은 bagging과 random feature selection을 결합한 ensemble 방법을 제시했다.
## FEM surrogate에서의 의미
Random Forest는 비선형성과 변수 상호작용을 명시적 feature engineering 없이 포착할 수 있다. Beam surrogate에서는 `h`, `b`, `L`, `P`, `E`의 비선형 영향과 interaction을 빠르게 잡는 비교 모델로 좋다.
## 구현 선택
이 튜토리얼에서는 scikit-learn의 `RandomForestRegressor`를 사용한다.
기본 설정 예:
```text
RandomForestRegressor(
n_estimators=300,
max_depth=None,
min_samples_leaf=2,
random_state=20260521,
n_jobs=-1
)
```
Tree model은 feature scaling이 필수는 아니지만, 다른 모델과 공통 전처리 구조를 설명하기 위해 입력 column 관리는 동일하게 유지한다.
## Notebook 실습 포인트
`notebooks/03_random_forest_surrogate.ipynb`는 다음을 보여준다.
1. 동일 dataset과 split 로드.
2. `n_estimators`, `max_depth`, `min_samples_leaf` 영향 비교.
3. test metric 계산.
4. parity plot과 residual plot.
5. permutation importance로 입력 변수 영향 확인.
6. feature importance와 beam 물리 관계 비교.
## 장점
- scaling에 덜 민감하다.
- 비선형성과 interaction을 잘 포착한다.
- outlier에 비교적 튼튼하다.
- feature importance를 계산하기 쉽다.
- 학습이 안정적이고 baseline으로 좋다.
## 한계와 실패 모드
- 예측이 piecewise constant라 매끄러운 응답면이 필요한 경우 부자연스러울 수 있다.
- 학습 데이터 범위 밖으로 외삽하지 못한다.
- 물리적으로 단조여야 하는 관계를 자동으로 보장하지 않는다.
- uncertainty는 GPR처럼 원래 제공되는 개념이 아니다.
- feature importance는 correlated feature에서 오해될 수 있다.
## 구조해석 해석 기준
Random Forest가 좋은 선택인 경우:
- 빠르고 안정적인 비선형 baseline이 필요하다.
- 변수 중요도 분석을 보고 싶다.
- 데이터가 중간 규모 이상이다.
- target이 매끄러운 global response다.
주의할 경우:
- 설계 최적화에서 매끄러운 gradient-like response가 필요하다.
- 외삽이 필요하다.
- 응답면의 국소 smoothness가 중요하다.
## References
- Breiman, L. (2001), "Random Forests", Machine Learning, 45, 5-32. https://doi.org/10.1023/A:1010933404324
- CiNii bibliographic record for Breiman (2001). https://cir.nii.ac.jp/crid/1360574092892023168
- scikit-learn `RandomForestRegressor` documentation. https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html