Inverse Problem and Model Inversion

Version 171 | Created: 2026-08-28 | Updated: 2026-11-25 23:03 UTC
- 1. Definition
- 2. Taxonomy
- 3. Inverse Model
- 4. Model Inversion
- 5. Solution Validity
- References
- Appendix A. Terminology
- Appendix B. Derivation of Eq. (3), (4), (5), (6), (8) and (9)
- Appendix C. PLS Inversion: Model Planes of the Bootstrap PLS Models and the Spread of the Solution
- Appendix D. PLS Inversion: Model Plane of One PLS and SPE
- Appendix E. Tools and Libraries
- Appendix F. Bagging Ensemble
- Appendix G. Python Example: PLS Model Inversion
- Appendix H. Python Example: Constrained Numerical Inversion
- Appendix I. Python Example: Inversion without Model Access
학습된 model 은 보통 입력에서 출력을 계산하는 방향으로 쓰인다. 원하는 출력을 먼저 정하고 그것을 만들어 내는 입력을 되찾는 문제가 inverse problem 이고, 이미 학습된 model 을 그 목적에 되돌려 쓰는 방법이 model inversion 이다. 이 문서는 두 용어를 정의하고, 해법을 다섯 축으로 분류한 다음, latent variable model inversion 의 고전적 결과와 model 종류별 inversion 방법을 정리하고, model 을 부를 수 없는 경우와 해의 검증까지 다룬다.
Forward problem 은 입력 변수
두 문제는 성질이 다르다. Forward 는 입력마다 하나의 출력을 주지만, inverse 는 답이 없거나 여러 개이거나 관측의 작은 잡음에 크게 흔들린다.
Forward problem 과 inverse problem, 그리고 inverse problem 의 두 해법인 inverse model 과 model inversion 의 관계는 아래 Fig 1 이다.
Problem
+-- Forward problem given x, find y
| +-- Physical model computes y from physical laws
| +-- Surrogate model y = f(x) data-driven model that replaces the physical model
+-- Inverse problem given y, find x
+-- Inverse model x = g(y) learn g directly
| aka direct (learned) inversion, learned inverse map
+-- Model inversion y = f(x), for x solve with the surrogate model f
aka optimization-based (iterative) inversion
Fig 1. Taxonomy of inverse problem 🌳
Inverse model 이 model 구조에 대한 이름이고, model inversion 은 model 을 뒤집는 행위의 이름이어서 짝이 맞지 않게 들릴 수 있다.
Forward problem 을 푸는
Well-posed 문제의 세 조건은 inverse problem 을 풀 때 무엇을 처리해야 하는지를 정한다. 잔차 최소화, regularization, 여러 해 가운데 하나를 고르는 처리 (2.1, 2.4) 는 각각 존재성 (existence), 안정성 (stability), 유일성 (uniqueness) 이 깨진 경우에 대응한다.
Well-posed 문제는 해가 존재하고, 유일하며, 데이터에 연속적으로 의존한다는 세 조건을 모두 만족한다. 세 조건 중 하나 이상을 어기는 문제를 ill-posed 라고 하며, inverse problem 은 대부분 여기에 속한다 [1].
- 존재성은
$\mathbf{y}^{\ast}$ 가$f$ 의 image 또는 range 밖에 있으면 깨진다. 정확히 맞추는 대신 잔차를 최소화하는 해로 문제를 바꾸어 완화한다. - 유일성은
$K \gt M$ 일 때 거의 항상 깨진다. 같은 출력을 주는 입력이 이루는 집합이 null space 이며, 해가 여럿이면 그중 하나를 골라야 한다. - 안정성은
$f$ 의 작은 특이값 방향에서 깨진다. 관측 잡음이 그 방향에서 크게 증폭되므로 regularization 으로 해의 크기를 눌러야 한다 [1].
Inverse model 은 출력에서 입력으로 가는 model
Model inversion 은 입력에서 출력으로 가는 model
Inverse problem 의 해법을 가르는 축을 Fig 2 에 정리한다.
Inverse problem (given a target y*, find the input x)
|
+-- Formulation (How to pose)
| +-- Deterministic ......................... minimize the residual under constraints -> model inversion
| +-- Bayesian .............................. posterior of x given y*, prior included -> both
|
+-- Search space (Where to search)
| +-- Input space ........................... x itself, constraints stated explicitly -> model inversion
| +-- Latent space .......................... scores or codes, low dimensional -> model inversion
|
+-- Solution method (How to solve)
| +-- Analytical inverse .................... pseudo-inverse, closed form for linear models -> model inversion
| +-- Numerical optimization ................ gradient based or derivative free search -> model inversion
| +-- Learned inverse map ................... a second model trained from y to x -> inverse model
| +-- Posterior sampling .................... MCMC, conditional generative models -> both
|
+-- Ambiguity handling (What fixes the answer)
| +-- Null space ............................ directions that leave the prediction unchanged -> model inversion
| +-- Regularization ........................ norm penalty, minimum-norm solution -> model inversion
| +-- Validity constraint ................... T^2 and SPE limits, input bounds -> both
| +-- Prior ................................. probability mass on plausible inputs -> both
|
+-- Answer form (What to return)
+-- Point ................................. one input vector -> both
+-- Region ................................ design space, null space segment -> model inversion
+-- Distribution .......................... posterior with uncertainty -> both
Fig 2. Taxonomy of inverse problem solution approaches
각 항목 끝의 화살표는 그 선택지가 Fig 1 의 model inversion 과 inverse model 가운데 어느 쪽에 쓰이는지를 나타내며, both 는 두 쪽 모두에 쓰인다는 뜻이다. Bayesian 정식화와 posterior sampling 은 MCMC 로
Deterministic 정식화는 잔차를 최소화하는 제약 최적화로 문제를 적는다.
여기서
두 정식화는 대응한다. 사후분포의 최빈값을 구하는 일은 음의 로그 우도를 잔차로, 음의 로그 사전분포를 regularization 으로 둔 최소화와 같다 [3]. Deterministic 쪽은 계산이 싸고, Bayesian 쪽은 multi-solution 과 불확실성을 그대로 보여 준다.
Input space 에서 직접 찾으면 model 종류를 가리지 않지만, 입력들 사이의 상관 구조를 지키라는 제약을 사람이 따로 넣어야 한다. Latent space 에서 찾으면 그 상관 구조가 이미 좌표계에 들어 있어, 차원이 줄고 물리적으로 있을 법한 후보만 탐색된다. PLS 의 score, autoencoder 의 code, normalizing flow 의 latent 변수가 모두 이 자리에 온다.
- Analytical inverse 는 선형 model 에서 pseudo-inverse 로 해를 닫힌 형태로 준다. 가장 싸지만 비선형 model 에는 쓸 수 없다.
- Numerical optimization 은
$f$ 를 그대로 두고 잔차를 줄인다. 미분이 되면 gradient 를, 안 되면 derivative-free 탐색을 쓴다. - Learned inverse map 은
$\mathbf{y}$ 에서$\mathbf{x}$ 로 가는 model 을 따로 학습한다. 학습이 끝나면$\mathbf{y}$ 를 한 번 넣어$\mathbf{x}$ 를 바로 얻지만, 같은$\mathbf{y}$ 에 여러$\mathbf{x}$ 가 대응하면 그 조건부 평균 하나를 내놓아 어느 해에도 맞지 않는 답이 된다 [4]. - Posterior sampling 은 해를 표본으로 뽑아 multi-solution 을 그대로 드러낸다. 비용이 가장 크다.
답이 여럿인 것은 유일성이 깨진 경우이며 (1.2), 그중 하나를 무엇으로 고르는가가 방법을 가른다. Null space 는 예측을 바꾸지 않는 방향을 명시해 남은 자유도 (degree of freedom)를 다른 목적에 쓰게 한다. Regularization 은 크기가 작은 해를 고른다. Validity constraint 는 historical data 가 덮은 영역 안으로 해를 가둔다. Prior 는 있을 법한 입력에 확률을 몰아준다. 앞의 셋은 deterministic 정식화에, 마지막은 Bayesian 정식화에 자연스럽게 붙는다.
Point 는 하나의 조건을 제시하므로 바로 실행할 수 있지만 여유가 없다. Region 은 목표 범위를 만족하는 입력 영역을 주며, design space 라는 이름으로도 쓰인다. Distribution 은 사후분포를 그대로 주어, 목표 범위를 만족할 확률로 판단하게 한다.
Inverse model 은 학습한
-
$g$ 가 해 하나를 내놓으면 3.1 Learned Inverse Map 의 방법을 쓴다. -
$g$ 가 사후분포를 내놓으면 3.2 Invertible Models 의 방법을 쓴다.
이 방법들을 구현하는 library 는 Appendix E 에 있다.
Fig 2 의 분류에서 이 절의 방법은 Solution method 는 Learned inverse map, Answer form 은 Point 를 고른 조합이다.
Learned inverse map 은
Fig 2 의 분류에서 이 절의 방법은 Formulation 은 Bayesian, Solution method 는 Posterior sampling, Answer form 은 Distribution 을 고른 조합이다.
Invertible neural network 와 normalizing flow 는 구조적으로 양방향이다. Forward 를 학습하면 inverse 가 함께 정의되고, 조건부 형태인 cINN 은 목표를 조건으로 준 사후분포에서 표본을 직접 뽑는다 [5]. 목표를 한 번 넣어 사후분포를 얻으므로, 같은
Model inversion 은
- Model 을 부를 수 있으면 4.1 Model-Specific Inversion Methods 의 Table 1 에서 그 model 의 계열을 찾아, 4.2 부터 4.7 가운데 그 계열의 방법을 쓴다.
- Model 을 부를 수 없으면 4.8 Inversion without Model Access 의 방법을 쓴다.
Latent variable 은 입력 변수들을 적은 수로 요약한 내부 좌표이며, PLS 에서는 score 라고 부른다. Latent variable 들이 이루는 공간이 latent space 이며, 이 좌표계에는 입력들 사이의 상관 구조가 이미 들어 있다 (2.2). Latent variable model 은 입력과 출력을 이 좌표로 함께 설명하며, PLS 와 PCR 이 여기에 속한다.
이 방법들을 구현하는 library 는 Appendix E 에 있다.
Fig 2 의 분류에서 이 절의 방법은 Solution method 축의 Analytical inverse, Numerical optimization, Posterior sampling 을 model 종류별로 나눈 것이며, 나머지 축의 선택은 model 종류마다 다르다.
Model 별 inversion 방법을 Table 1 에 정리한다.
Table 1. Inversion method by model family
| # | Model | Inversion method | Section | Characteristics |
|---|---|---|---|---|
| 1 | PLS / PCR | 해석적 역해와 null space | 4.2 | 선형이고 해가 유일하지 않으므로 minimum-norm solution 또는 제약 최적화로 고른다. Appendix G 가 이 행을 실행한다 |
| 2 | PLS bootstrap ensemble | Bootstrap 표본별 해석적 역해 | 4.2 | Bootstrap 표본마다 적합한 PLS 를 1 행의 절차로 각각 뒤집어, 해 하나 대신 해의 퍼짐을 준다 |
| 3 | OLS / Ridge | Pseudo-inverse | 4.2 | 잠재공간 제약이 없어 외삽 위험이 크다. Ridge 는 해를 줄일 뿐 입력 상관 구조를 지키지 않는다 |
| 4 | PCA | Pre-image problem | 4.2 | 출력이 없으므로 재구성 관점이다. 선형은 닫힌 해, kernel PCA 는 pre-image 를 반복 최적화로 근사한다 |
| 5 | Kernel PLS | Latent space 역해와 pre-image | 4.3 | 비선형 관계를 담되 score 에서 입력으로 되돌리는 단계가 pre-image 문제로 남는다 |
| 6 | GP | 사후분포 기반 역설계 | 4.3 | 불확실성을 함께 주므로 Bayesian optimization 의 기반이 된다 |
| 7 | Random forest / GBM | Surrogate search, TreeSHAP 기반 국소 선형화 | 4.4 | 미분이 불가하여 이산 탐색이나 genetic algorithm 을 쓴다. Appendix H 가 뒤집는 model 이 이 행이다 |
| 8 | Neural network | 입력에 대한 역전파 | 4.5 | 가장 직접적이며 activation maximization 과 같은 계산이다. Regularization 이 필수이다 |
| 9 | Autoencoder / VAE | Latent space 탐색 후 디코딩 | 4.6 | 생성 model 방식의 역설계이다 |
| 10 | Diffusion model | 사후 sampling | 4.6 | 잡음이 있는 비선형 문제에서 multi-solution 을 표본으로 얻는다 |
| 11 | Model-agnostic | 제약이 있는 numerical optimization | 4.7 | 어떤 |
| 12 | Model access 없음 | Surrogate re-fitting, nearest-sample lookup | 4.8 | Model 을 부를 수 없어 입력 vector 와 예측값의 쌍 |
Model 의 구조가 쓸 수 있는 방법을 정한다. 선형 model 은 닫힌 해를 주고, 미분 가능한 model 은 입력에 대한 gradient 를 주며, 조각별 상수인 tree 계열은 탐색에 기댄다. 4.2 부터 4.7 의 여섯 절이 계열별로 설명한다.
PLS 와 PCR 은 PLS inversion 의 절차로 뒤집힌다. PLS bootstrap ensemble 은 PLS 의 bagging 으로, bootstrap 표본마다 적합한 PLS 를 같은 절차로 각각 뒤집어, 해 하나 대신 해의 퍼짐을 준다 [6]. OLS 와 Ridge 도 pseudo-inverse 로 같은 형태의 해를 주지만, 해가 놓이는 공간이 다르다. 투영 model 의 해는 score 공간을 거치므로 입력들 사이의 상관 구조를 그대로 물려받는 반면, OLS 의 해는 그 구조 밖으로 자유롭게 나갈 수 있다. 상관된 입력을 가진 문제에서 OLS 역해는 물리적으로 불가능한 조합을 내놓는다. PCA 에는 맞출 출력이 아예 없으므로 문제의 성격 자체가 달라진다. 선형 PCA 는 score 에서 loading 으로 되돌리는 닫힌 해를 가지지만, kernel PCA 로 가면 그 되돌림이 4.3 의 kernel 계열에서 다루는 pre-image 문제가 된다.
Fig 2 의 분류에서 PLS inversion 은 Formulation 은 Deterministic, Search space 는 Latent space, Solution method 는 Analytical inverse, Ambiguity handling 은 Null space 와 Validity constraint, Answer form 은 Region 을 고른 조합이다.
PLS model 의 inversion 은 inverse problem 을 latent space 에서 푼 가장 오래된 산업 사례이며, 이후의 방법들이 되풀이하는 골격을 이미 갖추고 있다. 차원을 줄여 자유도를 정리하고, 줄인 공간에서 역해를 구하고, 유효 영역 제약으로 외삽을 막는 세 단계가 그것이다 [2], [7].
PLS model 로 목표 출력
- PLS inversion 의 Minimum-norm solution 방법: 식 (5) 의 pseudo-inverse 로 해 하나를 구한다.
- PLS inversion 의 Null space 방법: minimum-norm solution 을 null space 방향으로 옮겨, 같은
$\mathbf{y}^{\ast}$ 를 주는 다른 해를 식 (8), (9) 의$T^{2}$ 와 SPE 상한 안에서 구한다. - Model-agnostic numerical optimization 방법: 4.7 의 방법으로 입력
$K$ 개를 모두 직접 움직여 해를 구한다.
PLS 는 학습 표본
행렬마다의 크기는 아래와 같다.
-
$\mathbf{X} \in \mathbb{R}^{N \times K}$ : 입력. 행은 표본$N$ 개, 열은 입력 변수$K$ 개 -
$\mathbf{Y} \in \mathbb{R}^{N \times M}$ : 출력. 행은 표본$N$ 개, 열은 출력 변수$M$ 개 -
$\mathbf{T} \in \mathbb{R}^{N \times A}$ : score. 행은 표본$N$ 개, 열은 latent 변수$A$ 개 -
$\mathbf{P} \in \mathbb{R}^{K \times A}$ : 입력의 loading. 행은 입력 변수$K$ 개, 열은 latent 변수$A$ 개 -
$\mathbf{Q} \in \mathbb{R}^{M \times A}$ : 출력의 loading. 행은 출력 변수$M$ 개, 열은 latent 변수$A$ 개 -
$\mathbf{E} \in \mathbb{R}^{N \times K}$ : 입력의 잔차.$\mathbf{X}$ 와 같은 크기 -
$\mathbf{F} \in \mathbb{R}^{N \times M}$ : 출력의 잔차.$\mathbf{Y}$ 와 같은 크기
목표 출력
Minimum-norm solution 은 해 하나일 뿐이고, 목표
- 표본 하나에 대해 식 (4) 의 한 행은
$\mathbf{y}^{\top} = \mathbf{t}^{\top}\mathbf{Q}^{\top} + \mathbf{f}^{\top}$ 이고, 이 식에서$\mathbf{y} \in \mathbb{R}^{M}$ ,$\mathbf{t} \in \mathbb{R}^{A}$ ,$\mathbf{f} \in \mathbb{R}^{M}$ 는$\mathbf{Y}$ ,$\mathbf{T}$ ,$\mathbf{F}$ 의 한 행을 전치한 열 벡터이다. - 양변을 전치하면
$(\mathbf{t}^{\top}\mathbf{Q}^{\top})^{\top} = \mathbf{Q}\mathbf{t}$ 이므로$\mathbf{y} = \mathbf{Q}\mathbf{t} + \mathbf{f}$ 가 된다. - 잔차
$\mathbf{f}$ 를 빼면$\mathbf{y} = \mathbf{Q}\mathbf{t}$ 이다.
이
- Null space 는 출력을 바꾸지 않고 움직일 수 있는 입력의 자유도이다. 비용 같은 2차 목적을 이 자유도 위에서 최적화할 수 있다.
- Null space 를 따라 멀리 가면 historical data 가 뒷받침하지 않는 조건에 닿는다. 그래서 score 의 크기를 재는 Hotelling
$T^{2}$ 와 model plane까지의 거리를 재는 SPE (Squared Prediction Error) 에 상한을 두고 그 안으로 해를 가둔다 [7].
PLS inversion 의 Null space 방법은 점, 직선, 선분의 순서로 해를 구한다. PLS inversion 의 Minimum-norm solution 방법은 1 단계에서 멈춘다.
- 점: 식 (5) 의 pseudo-inverse 로 minimum-norm solution
$\mathbf{t}^{\ast} = \mathbf{Q}^{+}\mathbf{y}^{\ast}$ 를 구한다. - 직선:
$\mathbf{Q}\mathbf{n} = \mathbf{0}$ 을 만족하는 null space 방향$\mathbf{n}$ 을 구해,$\mathbf{t}^{\ast}$ 를 지나는 직선$\mathbf{t} = \mathbf{t}^{\ast} + \alpha\mathbf{n}$ 을 만든다. - 선분:
$T^{2}$ 상한으로$\alpha$ 의 범위를 정해, 직선을 Fig 3 (a) 의 선분 A–B 로 자른다.
두 상한이 score 평면에서 null space 를 어디까지 허용하는지는 아래 Fig 3 (a) 와 같고, Appendix G 의 데이터에서 bootstrap 표본 200 개마다 PLS 를 적합해 목표 2.0 의 minimum-norm solution 을 각각 구한 결과는 Fig 3 (b) 와 같다.
Fig 3. Null space in the score plane and the bootstrap spread of the solution in the input plane
- (a): score 평면의
$T^{2}$ 상한 타원과,$\mathbf{t}^{\ast}$ 를 지나는 null space 직선 가운데 타원 안에 든 선분 A–B 이다. 검은 화살표는 식 (7) 의$\mathbf{n}$ 방향이다. - (b): (a) 의
$\mathbf{t}^{\ast}$ 와 null space 직선을 입력 평면으로 옮긴 것과, PLS bootstrap ensemble 이 주는 bootstrap PLS 200 개의 minimum-norm solution 이다.
Fig 3 에서 PLS inversion 의 두 방법이 구하는 해는 아래이다.
- PLS inversion 의 Minimum-norm solution 방법: (a) 의
$\mathbf{t}^{\ast}$ 와 (b) 의 주황 별$\mathbf{x}^{\ast}$ 이다. (b) 의 파란 점 200 개도 bootstrap PLS 마다 이 방법으로 구한 해이다. - PLS inversion 의 Null space 방법: (a) 의 null space 직선 가운데
$T^{2}$ 상한 타원 안의 선분 A–B 와, 그 직선을 입력 평면으로 옮긴 (b) 의 빨간 점선이다.
타원은
(b) 는 (a) 를 입력 평면으로 옮긴 것이다. 주황 별은 (a) 의
파란 점 200 개는 PLS bootstrap ensemble (Table 1 의 2 행, Appendix F) 의 해이다. Bootstrap 표본마다 적합한 PLS 를 식 (5), (6) 의 절차로 각각 뒤집어 minimum-norm solution 을 하나씩 구한 것이며, 표준편차는 element
같은 골격을 산업 문제로 넓힌 결과는 다음 넷이다.
- 두 site 의 데이터를 하나의 latent space 로 묶는 Joint-Y PLS 는, 한 site 에서 검증된 조건을 다른 site 의 조건으로 옮기는 product transfer 를 inversion 문제로 만든다 [8].
- Model parameter 의 불확실성을 해에 전파하면 목표 범위를 만족하는 영역이 좁아진다. 이 보수적인 영역을 design space 라 부른다 [9].
- 목표가 등식이 아니라 상하한으로 주어지거나, 일부 입력이 고정되거나, 목표가 여러 개인 경우가 모두 하나의 제약 최적화로 통합되었다 [10].
- 최근 정식화는 score 공간에서 풀 것인가 입력 공간에서 풀 것인가를 문제의 제약 구조로 결정하고, null space 를 유지한 채
$T^{2}$ 와 SPE 제약을 함께 넣는다 [11], [12].
Kernel 계열은 특징 공간에서는 선형이지만 그 공간의 점에 대응하는 입력이 일반적으로 존재하지 않는다. 그래서 특징 공간의 해를 입력 공간으로 되돌리는 pre-image 를 반복 최적화나 고정점 방법으로 근사한다 [13]. Gaussian process 는 예측과 함께 분산을 주므로 뒤집는 방법이 달라진다. 목표에서 벗어난 정도와 불확실성을 함께 담은 acquisition function 을 정의하고 그것을 최적화하면, 다음에 시험할 입력을 정하는 Bayesian optimization 이 된다 [14]. 해를 한 번에 구하지 않고 실험을 반복하며 좁혀 간다는 점에서 앞의 방법들과 성격이 다르다.
Random forest 와 gradient boosting 은 tree 를 base learner 로 쓴다. Tree 하나는 입력 공간을 문턱값으로 잘라 상자로 나누고 상자마다 저장된 값 하나를 돌려주며, 그런 함수를 여럿 더하거나 평균해도 조각별 상수 함수이다. 그래서 입력에 대한 gradient 가 상자 안에서는 0 이고 문턱값 위에서는 정의되지 않아, gradient 대신 탐색을 쓴다. 이 성질은 boosting 이나 bagging 이 아니라 base learner 가 정하며, base learner 를 선형 model 로 두면 합도 선형이 되어 gradient 가 살아난다. 격자 탐색, genetic algorithm, CMA-ES 같은 derivative-free 방법이 그대로 쓰이며, 학습된 tree 자체를 빠른 surrogate 로 두고 그 위에서 탐색을 돌린다. TreeSHAP 은 한 점 주변에서 각 입력의 기여도를 정확히 계산하므로, 국소 선형 근사를 얻어 탐색의 방향을 정하는 데 쓸 수 있다 [15].
미분 가능한 network 는 가장 직접적으로 뒤집힌다. 가중치를 고정한 채 입력을 변수로 두고
생성 model 은 데이터 분포를 학습하므로 그 자체가 강한 prior 이다. Autoencoder 와 VAE 는 latent 공간에서 탐색한 뒤 디코딩하며, 디코더가 만들어 낼 수 있는 것만 후보가 되므로 비현실적인 해가 걸러진다. 유효한 설계만 후보로 남아야 하는 문제에서 이 방식이 표준으로 쓰인다 [17]. 조건부 형태의 invertible model 은
Model 구조를 전혀 쓰지 않고
Fig 2 의 분류에서 이 절의 방법은 Solution method 축에서 surrogate re-fitting 이 4.1 의 방법을 쓰며, nearest-sample lookup 은 Fig 2 에 없다. Ambiguity handling 은 두 방법 모두 Validity constraint 이다.
Model 을 부를 수 없어도 입력 vector 와 예측값의 쌍
- Surrogate re-fitting: 가진 쌍으로
$\hat{y}$ 를 맞추는 새 model 을 학습하고, 그 surrogate 를 4.1 의 방법으로 뒤집는다. 원 model 의 예측을 정답으로 삼아 다른 model 로 옮기는 것이므로 model distillation 이며, 해의 오차는 원 model 의 잔차가 아니라 surrogate 의 재현 오차가 정한다. - Nearest-sample lookup: 목표에 가장 가까운
$\hat{y}_i$ 를 가진 입력 vector$\mathbf{x}_i$ 를 뽑고 그 이웃에서 보간한다. 가장 싸지만 쌍이 덮은 영역 밖으로는 나가지 못한다.$f$ 도$g$ 도 쓰지 않으므로 Fig 1 의 두 해법 어디에도 속하지 않는다.
유효 영역은 두 방법 모두
한계는 쌍이 덮는 영역이다. Surrogate 는 그 영역 밖에서 원 model 과 다르게 움직이는데, 원 model 을 부를 수 없으므로 얼마나 다른지 확인할 길이 없다. 그래서 해를 그 영역 안으로 가두는 제약이 model 을 가진 경우보다 더 중요하다. 두 방법과 3.1 의 learned inverse map 을 이어 붙인 예시는 Appendix I 에 있다.
Inversion 의 결과는 model 이 참이라는 가정 아래 나온 제안이므로, 실행 전에 다음 네 가지를 확인한다.
- 외삽: model 은 historical data 가 덮은 영역에서만 신뢰할 수 있다.
$T^{2}$ 는 그 영역 안에서 중심으로부터 얼마나 멀리 있는지를, SPE 는 영역이 이루는 면에서 얼마나 떨어졌는지를 잰다. 둘 중 하나만 보면 상관 구조가 깨진 해를 놓친다. - Multi-solution: 답이 하나가 아니면 하나만 골라 보고하지 않는다. Null space 구간이나 사후분포처럼 답의 집합을 보여 주는 편이 판단에 도움이 된다.
- 불확실성: GP, Bayesian, flow 계열은 사후분포를 주므로 목표 범위를 만족할 확률로 해를 평가할 수 있다 [3]. 점 추정만 주는 model 은 그 확률을 낼 수 없으므로 별도의 검증이 필요하다.
- 검증과 갱신: 얻은 입력은 실험이나 시뮬레이션으로 확인하고, 그 결과를 데이터에 더해 model 을 다시 학습하는 closed loop 를 둔다. 이 재학습이 없으면 model 의 오차가 그대로 설계 오차가 된다.
[1] Kaipio, J., Somersalo, E. (2005). Statistical and Computational Inverse Problems. Springer, Applied Mathematical Sciences 160.
[2] Jaeckle, C. M., MacGregor, J. F. (1998). Product design through multivariate statistical analysis of process data. AIChE Journal, 44(5), 1105–1118.
[3] Stuart, A. M. (2010). Inverse problems: a Bayesian perspective. Acta Numerica, 19, 451–559.
[4] Ongie, G., Jalal, A., Metzler, C. A., Baraniuk, R. G., Dimakis, A. G., Willett, R. (2020). Deep learning techniques for inverse problems in imaging. IEEE Journal on Selected Areas in Information Theory, 1(1), 39–56.
[5] Ardizzone, L., Kruse, J., Wirkert, S., et al. (2019). Analyzing inverse problems with invertible neural networks. International Conference on Learning Representations.
[6] yRocket. (2026). PLS Bootstrap Ensemble. AIML repository, GitHub.
[7] Jaeckle, C. M., MacGregor, J. F. (2000). Industrial applications of product design through the inversion of latent variable models. Chemometrics and Intelligent Laboratory Systems, 50(2), 199–210.
[8] García-Muñoz, S., MacGregor, J. F., Kourti, T. (2005). Product transfer between sites using Joint-Y PLS. Chemometrics and Intelligent Laboratory Systems, 79(1–2), 101–114.
[9] García-Muñoz, S., Dolph, S., Ward, H. W. (2010). Handling uncertainty in the establishment of a design space for the manufacture of a pharmaceutical product. Computers & Chemical Engineering, 34(7), 1098–1107.
[10] Tomba, E., Barolo, M., García-Muñoz, S. (2012). General framework for latent variable model inversion for the design and manufacturing of new products. Industrial & Engineering Chemistry Research, 51(39), 12886–12900.
[11] Palací-López, D., Facco, P., Barolo, M., Ferrer, A. (2019). New tools for the design and manufacturing of new products based on latent variable model inversion. Chemometrics and Intelligent Laboratory Systems, 194, 103848.
[12] Palací-López, D., et al. (2020). Improved formulation of the latent variable model inversion-based optimization problem for quality by design applications. Journal of Chemometrics, 34(6), e3230.
[13] Kwok, J. T., Tsang, I. W. (2004). The pre-image problem in kernel methods. IEEE Transactions on Neural Networks, 15(6), 1517–1525.
[14] Shahriari, B., Swersky, K., Wang, Z., Adams, R. P., de Freitas, N. (2016). Taking the human out of the loop: a review of Bayesian optimization. Proceedings of the IEEE, 104(1), 148–175.
[15] Lundberg, S. M., Erion, G., Chen, H., et al. (2020). From local explanations to global understanding with explainable AI for trees. Nature Machine Intelligence, 2, 56–67.
[16] Simonyan, K., Vedaldi, A., Zisserman, A. (2014). Deep inside convolutional networks: visualising image classification models and saliency maps. arXiv:1312.6034.
[17] Gómez-Bombarelli, R., Wei, J. N., Duvenaud, D., et al. (2018). Automatic chemical design using a data-driven continuous representation of molecules. ACS Central Science, 4(2), 268–276.
[18] Chung, H., Kim, J., McCann, M. T., Klasky, M. L., Ye, J. C. (2023). Diffusion posterior sampling for general noisy inverse problems. International Conference on Learning Representations.
[19] yRocket. (2026). Scores in Partial Least Squares. Math repository, GitHub.
- Acquisition function: 예측값과 불확실성을 함께 담아 다음에 시험할 입력을 고르는 함수이다.
- Activation maximization: 학습된 network 의 특정 출력이 최대가 되는 입력을 입력에 대한 역전파로 찾는 방법이다.
- Bayesian optimization: 사후분포를 가진 surrogate model 과 acquisition function 으로 blackbox 함수의 최적점을 반복 탐색하는 방법이다.
- cINN: 조건을 입력으로 받는 invertible neural network 이며, 조건부 사후분포에서 표본을 뽑는다.
- CMA-ES: 공분산 행렬을 갱신하며 표본을 뽑아 최적점을 찾는 derivative-free optimization 방법이며 covariance matrix adaptation evolution strategy 의 약자이다.
- COBYLA: 선형 근사를 갱신하며 제약이 있는 문제를 푸는 derivative-free optimization 방법이며 constrained optimization by linear approximations 의 약자이다.
- Derivative-free optimization: 목적 함수의 gradient 없이 함수값만으로 해를 찾는 최적화이다.
- Design space: 출력의 목표 범위를 만족하는 것으로 확인된 입력 영역이다.
- Forward problem: 입력에서 출력을 계산하는 문제이다.
- GBM: 잔차를 순차적으로 학습하는 tree 를 더해 만드는 model 이며 gradient boosting machine 의 약자이다.
- GP: 함수에 대한 사전분포를 두어 예측과 분산을 함께 주는 model 이며 Gaussian process 의 약자이다.
-
Hotelling
$T^{2}$ : score 가 model 중심에서 얼마나 떨어져 있는지를 재는 통계량이다. - Ill-posed problem: 해의 존재성, 유일성, 안정성 중 하나 이상이 깨진 문제이다.
-
Image:
$f$ 가 내놓을 수 있는 출력을 모두 모은 집합이며, range 라고도 부른다. - Inverse model: 출력에서 입력으로 가는 사상을 데이터로 직접 학습한 model 이며, learned inverse map 또는 역모델이라고도 부른다.
- Joint-Y PLS: 여러 site 의 데이터를 공통 출력으로 묶어 하나의 latent space 에서 다루는 PLS 확장이다.
- Latent variable: 관측 변수들을 적은 수로 요약한 내부 좌표이며, PLS 에서는 score 라고 부른다.
- Loading: Latent 변수와 관측 변수를 잇는 계수이며, score 에서 입력을 복원할 때 쓰인다.
- Mahalanobis distance: 각 방향의 산포로 나누어 재는 거리이며, 중심에서 표준편차 몇 배만큼 떨어졌는지를 나타낸다.
- MCMC: 사후분포를 따르는 표본을 연쇄적으로 생성하는 sampling 방법이며 Markov chain Monte Carlo 의 약자이다.
- Minimum-norm solution: 목표를 똑같이 만족하는 해가 여럿일 때 그중 norm 이 가장 작은 해이다.
- Model distillation: 원 model 의 예측을 정답으로 삼아 다른 model 을 학습시켜 그 입출력 관계를 옮기는 방법이다.
- Model inversion: 이미 가진 forward model 을 거꾸로 풀어 목표 출력을 내는 입력을 찾는 방법이다.
- Multi-solution: 같은 출력을 만드는 입력 조합이 여럿 있는 상태이다.
- Normalizing flow: 가역 변환의 합성으로 분포를 다른 분포로 옮기는 생성 model 이다.
- Null space: 예측 출력을 바꾸지 않는 입력 또는 score 의 방향이 이루는 부분공간이다.
- Null space direction: null space 의 기저 벡터 하나이며, 그 방향으로 score 를 움직여도 예측 출력이 바뀌지 않는다.
- OLS: 잔차 제곱합을 최소화하는 회귀이며 ordinary least squares 의 약자이다.
- PCA: 분산이 큰 방향으로 좌표를 다시 잡아 차원을 줄이는 방법이며 principal component analysis 의 약자이다.
- PCR: 주성분으로 축소한 뒤 회귀하는 model 이며 principal component regression 의 약자이다.
- Physical model: 물리 법칙으로 입력에서 출력을 계산하는 model 이다.
- PLS: 입력과 출력의 공분산이 큰 방향으로 latent 변수를 뽑는 회귀 model 이며 partial least squares 의 약자이다.
- PLS bootstrap ensemble: 행을 복원추출 (sampling with replacement) 한 표본, 곧 bootstrap 표본마다 PLS 를 적합하고, 그 PLS 들의 예측을 평균하는 ensemble, 곧 PLS 의 bagging 이다.
- Posterior sampling: 사후분포에서 표본을 뽑아 해의 집합을 얻는 방법이다.
- Pre-image problem: 특징 공간의 한 점에 대응하는 입력 공간의 점을 찾는 문제이다.
- Pseudo-inverse: 정방이 아니거나 특이한 행렬에 대해 minimum-norm 최소제곱 해를 주는 일반화 역행렬이다.
- Regularization: 해의 크기나 형태에 벌점을 주어 ill-posed problem 을 안정화하는 방법이다.
- Score: 관측을 latent 좌표계로 투영한 값이다.
- SPE: 관측이 model plane에서 벗어난 거리의 제곱이며 squared prediction error 의 약자이다.
- Surrogate model: 원래 model (physical model 이나 직접 부를 수 없는 model) 을 대신해 (x, y) 쌍으로 학습한 data-driven forward model 이다.
- TreeSHAP: Tree model 에서 각 입력의 기여도를 다항 시간에 정확히 계산하는 방법이다.
- VAE: Latent 변수의 분포를 학습하는 생성 model 이며 variational autoencoder 의 약자이다.
- Validity domain: model 이 학습 데이터로 뒷받침되는 입력 영역이다.
- Well-posed problem: 해가 존재하고 유일하며 데이터에 연속적으로 의존하는 문제이다.
이 식들은 PLS 가 score 를 뽑는 절차에서 차례로 나온다.
PLS 는 latent 변수
해는
식 (14) 의 빼는 식을
열을 모은 행렬의 곱은 열마다의 곱을 더한 것과 같아
따라서 식 (3), (4) 가 유도된다.
빼는 단계 때문에 score vector
식 (3), (4) 의 한 행을 열 벡터로 적으면, 잔차를 뺀 입력과 출력은 같은 score
그 해는 아래 두 식을 만족한다.
식 (28) 은
SPE 는 입력
식 (6) 의
Fig 3 (b) 의 PLS bootstrap ensemble 을 입력이 3 개인 경우로 그리면 아래 Fig 4 이다.
Fig 4. Model plane of one PLS and model planes of the bootstrap PLS models
- (a): 모든 행으로 적합한 PLS 하나의 model plane (빨간 면) 과 그 minimum-norm solution
$\mathbf{x}^{\ast}$ (주황 별) 이다. 회색 점은 학습에 쓴$\mathbf{X}$ 의 행이다. - (b): bootstrap 표본마다 적합한 PLS 의 model plane (파란 면) 과 그 minimum-norm solution (파란 점) 이다. 빨간 면과 주황 별은 (a) 와 같다.
파란 면은 bootstrap PLS 마다 구한
SPE 와 model plane의 관계를 입력이 3 개인 경우로 그리면 아래 Fig 5 이다.
Fig 5. Row space and column space of the loading matrix P, the T^2 limit and SPE
- (a):
$\mathbf{P}$ 의 row space, 곧 score 공간이다. 그 위의 타원, null space 직선, 선분 A–B,$\mathbf{t}^{\ast}$ 는 Fig 3 (a) 와 같은 구성이다. 검은 화살표는 식 (7) 의$\mathbf{n}$ 방향이다. - (b):
$\mathbf{P}$ 의 column space, 곧 model plane 이다. (a) 의 점을$\mathbf{x} = \mathbf{P}\mathbf{t}$ 로 옮긴 것이며, 평면을 벗어난 vector$\mathbf{x}_{c}$ 의 수선 길이 제곱이 SPE 이다. 검은 화살표$\mathbf{P}\mathbf{n}$ 은 (a) 의$\mathbf{n}$ 을$\mathbf{x} = \mathbf{P}\mathbf{t}$ 로 옮긴 방향이다.
Fig 5 에서 해를 구하는 방법은 아래의 3 가지이다.
- PLS inversion 의 Minimum-norm solution 방법: (a) 의
$\mathbf{t}^{\ast}$ 와 (b) 의$\mathbf{x}^{\ast}$ 점 하나이다. - PLS inversion 의 Null space 방법: (a) 와 (b) 의 null space 직선 가운데
$T^{2}$ 상한 안의 선분 A–B 이다. - Model-agnostic numerical optimization 방법: 4.7 의 방법으로 입력
$K$ 개를 모두 직접 움직여 구한 해이며, (b) 의 보라 동그라미가 그 예이다. 4.2 Design space 목록처럼 일부 입력이 고정되거나 4.7 처럼 입력에 물리적 한계가 걸려, 그 제약과 목표$\mathbf{y}^{\ast}$ 를 함께 만족하는$\mathbf{t}$ 가 없을 때 쓴다.
파란 면은 model plane, 곧
Model-agnostic numerical optimization 방법의 해인 보라 동그라미 vector
Table 2. Libraries for inverse model and model inversion
| Library | Role | Section | Note |
|---|---|---|---|
| NumPy / SciPy | Pseudo-inverse, null space, 제약 최적화 | 4.2, 4.7 | numpy.linalg.pinv, scipy.linalg.null_space, scipy.optimize.minimize |
| scikit-learn | Latent variable model 과 유효 영역 | 4.2, 4.3, Appendix F | PLSRegression, PCA, GaussianProcessRegressor, resample |
| PyTorch | 입력에 대한 gradient | 4.5 | 입력 tensor 에 gradient 를 켜고 역전파한다 |
| BoTorch / GPyTorch | GP 기반 Bayesian optimization | 4.3 | Acquisition function 최적화를 제공한다 |
| SHAP | Tree model 의 국소 선형화 | 4.4 | TreeSHAP 으로 기여도를 정확히 계산한다 |
| FrEIA | Invertible neural network | 3.2 | cINN 구조를 조립한다 |
| PyMC / emcee | 사후분포 sampling | 2.1, 2.3 | Bayesian 정식화의 표본 기반 해법이다 |
Bagging 은 bootstrap aggregating 의 줄임말이며, 같은 model 을 여러 개 학습하고 그 예측을 합쳐 최종 예측을 정하는 ensemble 방식이다. 절차는 아래 세 단계이다.
- Bootstrapping: 원래 학습 데이터에서 행을 복원추출하여, 개별 model 마다 학습 표본을 하나씩 만든다.
- 개별 학습과 예측: 표본마다 model 을 하나씩 학습하고, 각 model 이 따로 예측한다.
- Aggregating: 개별 예측을 합쳐 최종 예측을 정한다. 회귀에서는 평균을, 분류에서는 다수결을 쓴다.
복원추출 (sampling with replacement) 은 한 행을 뽑은 뒤 그 행을 다시 후보로 되돌려 놓고 다음 행을 뽑는 방식이다. 원래 데이터가
Definition: Bagging ensemble
세 단계를 합친 방식을 bagging ensemble 이라 부른다.
PLS bootstrap ensemble 은 개별 model 을 PLS 로 둔 bagging ensemble 이다 [6].
4.2 의 절차를 그대로 실행한다. Minimum-norm solution 을 구한 뒤 null space 방향으로 움직여도 예측값이 같은지 확인한다. Appendix G, E, F 의 예시는 모두 난수 데이터를 쓰는 최소 실행 예시이며, NumPy, SciPy, scikit-learn 과 Appendix I 의 pandas 만 있으면 그대로 돌아간다.
import numpy as np
from scipy.linalg import null_space
from sklearn.cross_decomposition import PLSRegression
rng = np.random.default_rng(0)
# historical data: 2 inputs, 1 output
# both inputs are centred at 0, x1 spread twice as wide as x2
n, n_comp = 100, 2
X = np.column_stack([rng.normal(0.0, 1.0, n), rng.normal(0.0, 0.5, n)])
drift = 2.0 * (np.arange(n) / 80.0) ** 3 # the sample order the model never sees
y = 1.5 * X[:, 0] - 0.8 * X[:, 1] + drift + rng.normal(0, 0.85, n)
x_mean, y_mean = X.mean(axis=0), y.mean()
pls = PLSRegression(n_components=n_comp, scale=False).fit(X - x_mean, y - y_mean)
P = pls.x_loadings_ # (2, n_comp)
Q = pls.y_loadings_ # (1, n_comp)
# 1. direct inversion: minimum-norm scores that hit the target value
y_des = 2.0
t_star = np.linalg.pinv(Q) @ np.array([y_des - y_mean])
x_star = P @ t_star + x_mean
# 2. null space: 37 inputs along the direction that leaves the prediction unchanged
Z = null_space(Q) # (n_comp, n_comp - 1)
alphas = np.linspace(-2.0, 2.0, 37)
x_alt = np.array([P @ (t_star + Z @ np.array([a])) + x_mean for a in alphas])
def predict(x):
return float(pls.predict((x - x_mean)[None, :]).ravel()[0]) + y_mean
preds = np.array([predict(x) for x in x_alt])
print("null space dim :", Z.shape[1])
print("solutions :", len(x_alt))
print("prediction min :", round(preds.min(), 6))
print("prediction max :", round(preds.max(), 6))
print("input spread :", np.round(x_alt.max(axis=0) - x_alt.min(axis=0), 3))뒤집기 전에 뒤집을 model 부터 본다.
Fig 6. Appendix G measured values in sample order, the inputs
Fig 6 (a) 는 표본이 들어온 순서대로 측정값
Fig 6 (b) 는 같은 표본의 두 입력을 그린 것이다. 등고선은 표본이 흩어진 모양을 나타내고, 위와 오른쪽의 막대는 각 입력이 따로 이루는 분포이다. 두 입력은 평균이 0 으로 같고 산포만 달라 element
등고선은 표본 중심에서 잰 Mahalanobis distance 이며, 안쪽부터 1, 2, 3 이다. 이 거리는 각 방향의 산포로 나누어 재므로, 산포가 큰 element
Fig 6 (c) 는 같은 100 개 표본의 parity plot 이며, 점 하나가 표본 하나이다. 가로축은 그 표본의 측정값
이 예시의 model 은
Code 가 만든 x_alt 37 개를 Fig 7 에 그린다.
Fig 7. Predicted value and inputs along the null space
두 panel 의 점 하나는 모두 같은 것, 곧 null space 방향
- (a) 의 가로축은 그 입력이 minimum-norm solution 에서 떨어진 거리
$\lVert \mathbf{x}(\alpha) - \mathbf{x}^{\ast} \rVert$ 이고 세로축은 그 입력을 model 에 넣어 얻은 예측값이다. 입력이 2.0 만큼 멀어지는 동안에도 예측값은 목표 2.000 에 붙어 있다. - (b) 는 같은 37 개를 두 입력의 평면에 그린 것이다. 해가 하나가 아니라 직선을 이루고, 그 위 어느 점을 골라도 예측은 2.000 이며, 주황으로 표시한 minimum-norm solution 은 그 직선 위의 한 점이다.
Minimum-norm solution 은 목표를 똑같이 만족하는 해가 여럿일 때 그중 norm 이 가장 작은 해이다. 이 예시에서
Minimum-norm solution 은 목표 출력을 내되 입력의 평균에서 가장 적게 벗어난 조합이다. 유일하게 정해지는 기준점이므로 출발점으로 쓰며, 비용 같은 다른 기준이 있으면 Fig 7 처럼 null space 를 따라 옮겨 간다.
Null space 방향은 그쪽으로 score 를 움직여도 예측이 바뀌지 않는 방향이며, null_space(Q) 가 그것을 단위 벡터로 돌려준다. x_alt 37 개는 그 방향으로
Model 이 입력에 대해 선형이므로 해집합은 직선이 된다. 예측은 회귀 계수 vector
해집합을 정하는 것은 측정값
입력이
미분이 되지 않는 gradient boosting model 을 blackbox 로 두고 4.7 의 model-agnostic numerical optimization 방식으로 뒤집는다. 유효 영역은 historical data 에 맞춘 PCA 의
import numpy as np
from scipy.optimize import minimize
from scipy.stats import chi2
from sklearn.decomposition import PCA
from sklearn.ensemble import GradientBoostingRegressor
rng = np.random.default_rng(0)
# the same 100 samples and the same value as Appendix G
n = 100
x1 = rng.normal(0.0, 1.0, n)
x2 = rng.normal(0.0, 0.5, n)
drift = 2.0 * (np.arange(n) / 80.0) ** 3
y = 1.5 * x1 - 0.8 * x2 + drift + rng.normal(0, 0.85, n)
# x3 and x4 follow x1 and x2, so the four inputs are not free of each other
X = np.column_stack([x1, x2,
0.9 * x1 + 0.1 * rng.normal(size=n),
-0.7 * x2 + 0.1 * rng.normal(size=n)])
forward = GradientBoostingRegressor(random_state=0).fit(X, y)
# validity domain of the historical data, described by a 2-component PCA
pca = PCA(n_components=2).fit(X)
t2_limit = chi2.ppf(0.95, df=2)
spe_train = np.sum((X - pca.inverse_transform(pca.transform(X))) ** 2, axis=1)
spe_limit = float(np.quantile(spe_train, 0.95))
def t2(x):
# distance from the centre inside the model plane
t = pca.transform(x[None, :])[0]
return float(np.sum(t ** 2 / pca.explained_variance_))
def spe(x):
# squared distance to the model plane: broken input correlation
return float(np.sum((x - pca.inverse_transform(pca.transform(x[None, :]))[0]) ** 2))
y_des = 1.0
def objective(x):
return float((forward.predict(x[None, :])[0] - y_des) ** 2)
# derivative-free search, since a boosted tree model is not differentiable
result = minimize(
objective,
x0=X.mean(axis=0),
method="COBYLA",
constraints=[
{"type": "ineq", "fun": lambda x: t2_limit - t2(x)},
{"type": "ineq", "fun": lambda x: spe_limit - spe(x)},
],
options={"maxiter": 3000},
)
x_sol = result.x
print("pred(x_sol) :", round(float(forward.predict(x_sol[None, :])[0]), 4))
print("T2 :", round(t2(x_sol), 2), "limit", round(t2_limit, 2))
print("SPE :", round(spe(x_sol), 3), "limit", round(spe_limit, 3))
print("x_sol :", np.round(x_sol, 3))뒤집기 전에 이 예시의 데이터도 같은 방식으로 본다.
Fig 8. Appendix H measured values in sample order, the correlated inputs x2 and x4, and the parity plot of the forward model
Fig 8 (a) 는 측정값을 순서대로 그린 것이다. Appendix G 와 같은 100 개 표본에 같은 값을 쓰므로 순서를 따르는 추세도 그대로이며, 목표만 1.0 으로 다르다.
Fig 8 (b) 는 상관이 있는 두 입력 x2 와 x4 의 평면이다. x4 가 x2 를
Fig 8 (c) 는 gradient boosting model 의 parity plot 이며,
두 제약을 모두 건 해와
Fig 9. Constrained solution against the validity limits
- (a) 는
x2–x4평면이다. 두 제약을 모두 건 해는 historical data 가 이루는 띠 위에 놓여 목표 1.0 을 맞추고,$T^{2}$ 만 건 해는 띠에서 한참 벗어난 자리에 놓이며 값도 0.65 에 그친다. - (b) 는 두 해의 통계량을 각자의 상한으로 나눈 값이다.
$T^{2}$ 만 건 해의 SPE 는 상한의 13 배이고,$T^{2}$ 는 두 해 모두 상한 아래이다.
4.8 의 방법을 그대로 실행한다. Feature A, B, C, D, E 와 참값 T 를 가진 100 행의 표에서 예측 P 를 얻은 뒤 model 을 가리고, 남은 표만으로 P 가 목표 19.0 이 되는 A 와 B 를 구한다. C, D, E 는 바꿀 수 없는 조건으로 주어져 평균에 고정하고, 손댈 수 있는 것은 A 와 B 뿐이다.
import numpy as np
import pandas as pd
from scipy.optimize import minimize
from scipy.stats import chi2
from sklearn.decomposition import PCA
from sklearn.ensemble import GradientBoostingRegressor
FEATURES = ["A", "B", "C", "D", "E"]
FREE = ["A", "B"]
N_ROWS, P_TARGET, N_STARTS, TOLERANCE = 100, 19.0, 5, 0.02
def make_dataset(n_rows: int = N_ROWS, seed: int = 0) -> pd.DataFrame:
"""Return the historical table with columns A, B, C, D, E, T and a RangeIndex."""
rng = np.random.default_rng(seed)
# the knob means put the true value near the target, the spreads keep it there
a = rng.normal(10.0, 0.7, n_rows) # knob
b = rng.normal(5.8, 0.35, n_rows) # knob
c = rng.normal(3.0, 0.3, n_rows) # measured context
d = 0.7 * c + rng.normal(0.0, 0.12, n_rows) # D follows C
e = rng.normal(2.0, 0.2, n_rows)
t = 0.9 * a + 1.4 * b + 0.6 * c - 0.5 * e + 0.02 * a * b + rng.normal(0.0, 0.85, n_rows)
return pd.DataFrame({"A": a, "B": b, "C": c, "D": d, "E": e, "T": t})
data = make_dataset()
X = data[FEATURES].to_numpy()
# the model we may call once: it leaves behind the column P, not itself
# shallow and short, so it fits the signal in T instead of memorising the noise
vendor_model = GradientBoostingRegressor(random_state=0, n_estimators=20, max_depth=2).fit(
X, data["T"].to_numpy())
data["P"] = vendor_model.predict(X)
del vendor_model # the model still exists, but nothing below can reach it
# 1. surrogate re-fitting: learn P from the pairs, not T
surrogate = GradientBoostingRegressor(random_state=0).fit(X, data["P"].to_numpy())
# the validity domain comes from the inputs alone, so it needs no model access
pca = PCA(n_components=2).fit(X)
t2_limit = chi2.ppf(0.95, df=2)
spe_limit = float(np.quantile(np.sum((X - pca.inverse_transform(pca.transform(X))) ** 2, axis=1), 0.95))
def t2(x: np.ndarray) -> float:
"""Distance from the centre inside the model plane."""
return float(np.sum(pca.transform(x[None, :])[0] ** 2 / pca.explained_variance_))
def spe(x: np.ndarray) -> float:
"""Squared distance to the model plane: broken input correlation."""
return float(np.sum((x - pca.inverse_transform(pca.transform(x[None, :]))[0]) ** 2))
# the context C, D, E is held at the condition we run at; only A and B are ours to set
context = X.mean(axis=0)
free_index = [FEATURES.index(name) for name in FREE]
def assemble(free_values: np.ndarray) -> np.ndarray:
"""Put the free A, B back into a full A..E row, the context features held at their mean."""
row = context.copy()
row[free_index] = free_values
return row
def objective(free_values: np.ndarray) -> float:
return float((surrogate.predict(assemble(free_values)[None, :])[0] - P_TARGET) ** 2)
# 2. nearest-sample lookup supplies the starting points
starts = data.iloc[(data["P"] - P_TARGET).abs().nsmallest(N_STARTS).index]
# 3. derivative-free search from each start, held inside the validity domain.
# A boosted tree is piecewise constant, so one start alone can stall on a flat box.
constraints = [
{"type": "ineq", "fun": lambda v: t2_limit - t2(assemble(v))},
{"type": "ineq", "fun": lambda v: spe_limit - spe(assemble(v))},
]
results = [
minimize(objective, x0=row[FREE].to_numpy(dtype=float), method="COBYLA",
constraints=constraints, options={"maxiter": 3000})
for _, row in starts.iterrows()
]
best = min(results, key=lambda r: r.fun)
solution = assemble(best.x)
r2_hidden = 1.0 - float(np.sum((data["T"] - data["P"]) ** 2) / np.sum((data["T"] - data["T"].mean()) ** 2))
print("rows :", len(data))
print("P range :", round(float(data["P"].min()), 2), "to", round(float(data["P"].max()), 2))
print("hidden R2 on T :", round(r2_hidden, 4))
print("surrogate R2 on P :", round(float(surrogate.score(X, data["P"].to_numpy())), 4))
print("P from each start :", [round(float(surrogate.predict(assemble(r.x)[None, :])[0]), 3) for r in results])
print("solved A, B :", np.round(best.x, 3))
print("P at solution :", round(float(surrogate.predict(solution[None, :])[0]), 4))
print("T2 :", round(t2(solution), 2), "limit", round(t2_limit, 2))
print("SPE :", round(spe(solution), 3), "limit", round(spe_limit, 3))
# 4. check the solution against the rows that were actually run near it
near = data[(np.abs(data["A"] - best.x[0]) <= TOLERANCE * abs(best.x[0]))
& (np.abs(data["B"] - best.x[1]) <= TOLERANCE * abs(best.x[1]))]
print("rows within 2% :", len(near))
print("their true T :", np.round(np.sort(near["T"].to_numpy()), 2))실행 결과는 아래이다.
rows : 100
P range : 17.59 to 20.46
hidden R2 on T : 0.7115
surrogate R2 on P : 0.9995
P from each start : [18.869, 19.006, 19.002, 19.002, 19.184]
solved A, B : [10.066 5.531]
P at solution : 19.0017
T2 : 0.0 limit 5.99
SPE : 0.063 limit 0.468
rows within 2% : 4
their true T : [17.85 18.56 19.01 19.8 ]
vendor_model 은 P 열을 남긴 뒤 del 로 가려진다. 그 뒤의 계산은 표의 A–E 와 P 만 읽으므로, model 은 그대로 있되 이 code 에서 닿을 수 없는 상황이 된다.
세 방법이 한 줄기로 이어진다. Surrogate 가 P 를 C, D, E 를 평균에 고정한 채 COBYLA 를 돌려 얻은 P 는 18.869 에서 19.184 까지 흩어지며, 그중 가장 가까운 A = 10.066, B = 5.531 이 P = 19.002 를 낸다.
이 결과를 Fig 10 에 그린다.
Fig 10. Appendix I hidden model against T, the search in the A–B plane, the surrogate against P, and the rows run within 2% of the solution
- (a) 는 가려진 model 의 parity plot 이다. 가로축은 참값
T이고 세로축은 그 model 이 남긴P이며,$R^{2} = 0.712$ 이다.T는 평균 19.1, 표준편차 1.3 으로 목표 19.0 을 중심에 두고 몰려 있어 100 행 가운데 51 행이 목표에서 1 이내에 들며, 뒤집을 대상의 정확도가 여기까지이므로 inversion 의 정확도도 이 값을 넘지 못한다. - (b) 는
A–B평면이다. 회색 등고선은C,D,E를 평균에 고정했을 때 surrogate 가 내는P이고, 굵은 선이 목표 19.0 의 등위선이다. 주황 표식 다섯 개가 출발점이고, 별이 그중 목표에 가장 가까운 해이다. - (c) 는 surrogate 가
P를 얼마나 따라가는지 보인다. 가로축은 가려진 model 이 남긴P열이고 세로축은 surrogate 의 예측이며,$R^{2} = 0.9995$ 로 점이 1:1 선에 붙어 있다. - (d) 는 해의
A= 10.066,B= 5.531 에서 2% 안에 든 historical 행만 그린 것이다. 가로축이 그 행의 참값T, 세로축이 surrogate 의 예측이며, 그런 행은 4 개이고 참값은 17.85, 18.56, 19.01, 19.80 이다.
(c) 의 GradientBoostingRegressor 를 surrogate 로 쓴 결과이다. 실제로는 가려진 model 의 계열을 알 수 없어 surrogate 가 다른 계열이 되고, 재현 오차는 이보다 커진다. 해의 오차를 정하는 것이 그 재현 오차이므로, surrogate 를 고른 뒤에는 (c) 같은 그림으로 그 크기부터 확인한다.
(d) 는 해를 실제와 맞대어 본 것이다. 네 행의 surrogate 예측은 모두 19.0 부근인데 참값은 17.85 에서 19.80 까지 퍼져 있어, 같은 조건으로 실제로 실행해도 목표를 그대로 얻지는 못한다. 이 퍼짐은 (a) 가 보인 가려진 model 의
등고선이 계단 모양이다. Surrogate 가 4.4 의 tree ensemble 과 같은 조각별 상수 함수이므로 예측이 문턱값을 넘을 때만 바뀌고, 그 사이에서는 상수로 남아 한 계단을 이룬다.
출발점을 다섯 개 쓰는 이유도 그 계단에 있다. 한 상자 안에서는 목적 함수가 평평해 탐색이 움직일 방향을 찾지 못하고 그 자리에서 멈추므로, 한 출발점만 쓰면 18.869 나 19.184 처럼 목표에서 벗어난 자리에 갇힌다. 4.7 이 말한 대로 여러 시작점에서 반복하고 그중 가장 좋은 해를 고른다.
해는 유효 영역 안에 있다. P 는 surrogate 의 예측이므로, 가려진 model 이 이 조건에서 실제로 낼 값과는 (c) 가 보이는 재현 오차만큼 벌어질 수 있다.








