2. White box model - dwweiss/grayboxes GitHub Wiki

Content


In the beginning it was all black and white.
Maureen O'Hara

2.1 Characteristics

In contrast to empirical modelling, theory based approaches derive process models from the fundamental physical or chemical mechanisms. Measurements are primarily employed for model fine-tuning and validation. Theoretical models provide the following advantages:

  • Flexibility with regard to changes of geometry, material, boundary conditions etc
  • Possibility of taking qualitative changes into account
  • Information for all unknowns at any location and possibility of simulating on small/large space scale and short/long-time scale
  • Isolation of particular phenomena, e.g. influence of gravity.

However, the computational requirements of theoretical 3D models are typically high even if simplifying assumptions are made. All input, including properties of matter or boundary conditions, must be known with a high accuracy. This drawback motivates the employment of the hybrid models proposed in the following section.


2.2 Summary


White box model
Requirement xtun = ∅
Prediction y = f(xcom)
Output y = ycomyunq
Meta model wmeta = arg min [ M(xcom , wmeta) - f(xcom) ]2
ymeta = f *(xcom) = M(xcom , wmeta)
Table 2.1 : Summary

M is a black box model in Table 2.1.


2.3 Example

import numpy as np
from grayboxes.array import grid
from grayboxes.black import Black
from grayboxes.plot import plot_isomap
from grayboxes.white import White

def func(x):
    return [x[0] + np.sin(x[1])]

x = grid((32, 32), [0., 1.], [-1., 3.])

y = White(f=func)(x=x)

M = Black()
metrics = M(X=x, Y=y, neurons=[4, 2], trainer='rprop')
print('Metrics of meta model training:', metrics)

y_meta = M(x=x)

plot_isomap(x[:,0], x[:,1],            y[:,0], labels=['x0','x1','y'])
plot_isomap(x[:,0], x[:,1],       y_meta[:,0], labels=['x0','x1','y_meta'])
plot_isomap(x[:,0], x[:,1], (y_meta - y)[:,0], labels=['x0','x1','dy'])

Figure 2.1: White box model result

Figure 2.2: Meta model result

Figure 2.3: Difference between results of meta model and of white box model

Home
⚠️ **GitHub.com Fallback** ⚠️