Update load surrogates
The process of creating a load surrogate model is often very tailored to the database and application, therefore we should try to keep the PyWake implementation as generic as possible. I propose to:
- Make a
SurrogateModel
class, with attributes:-
surrogate_model
: any surrogate model. For starting we should provide an interface to TensorFlow and OpenTURNS. Obviously, with the nice trick from Mads of not force all users to install these packages. -
input_transformers
:list
of input transformations. Default[]
. For example:MinMaxScaler
andPowerTransformer
from scikit-learn. I can see that both inherit fromTransformerMixin
, but in general I would accept anything that implementstransform()
. These will be applied in sequence before calling the surrogate. -
output_transformers
:list
of output transformations. Default[]
. For example:MinMaxScaler
andPowerTransformer
from scikit-learn. I can see that both inherit fromTransformerMixin
, but in general I would accept anything that implementsinverse_transform()
. These will be called in sequence after calling the surrogate. -
input_channel_names
:list
ofstr
. Default[]
. -
output_channel_names
:list
ofstr
. Default[]
. -
options
: dict. For example, the Wöhler exponent will end up here and not interfere with any other attribute. -
predict()
. To transform the input, call the surrogate and inverse transform the output. -
gradient()
. This is a bit tricky, because scikit-learn doesn't provide gradients, and therefore we have to do it. I already have the gradient for:MinMaxScaler
,StandardScaler
andPowerTransformer
with yeo-johnson method. For other types we will have to raise aNotImplementedError
. -
load()
. Let's use our setup with 1 file for the surrogate and the JSON for the extra data. Other users might monkey patch this function.
-
- Update the
DEL
function to callSurrogateModel
. This is where we useinput_channel_names
to make sure that the surrogate accepts the right inputs and that they are passed in the correct order. - Add a
SurrogateModel
object to the IEA 3.4 turbine model.
These are just my ideas, and I'm open for discussions