Scaling
The omlt.scaling module describes the interface for providing different scaling expressions to the Pyomo model for the inputs and outputs of an ML model. An implementation of a common scaling approach is included with OffsetScaling.
- class omlt.scaling.ScalingInterface[source]
Bases:
abc.ABC
- class omlt.scaling.OffsetScaling(offset_inputs, factor_inputs, offset_outputs, factor_outputs)[source]
Bases:
omlt.scaling.ScalingInterface
This scaling object represents the following scaling equations for inputs (x) and outputs (y)
\[\begin{split}\begin{align*} x_i^{scaled} = \frac{(x_i-x_i^{offset})}{x_i^{factor}} \\ y_i^{scaled} = \frac{(y_i-y_i^{offset})}{y_i^{factor}} \end{align*}\end{split}\]- Parameters
offset_inputs (array-like) – Array of the values of the offsets for each input to the network
factor_inputs (array-like) – Array of the scaling factors (division) for each input to the network
offset_outputs (array-like) – Array of the values of the offsets for each output from the network
factor_outputs (array-like) – Array of the scaling factors (division) for each output from the network
- get_scaled_input_expressions(input_vars)[source]
Get the scaled input expressions of the input variables.
- get_scaled_output_expressions(output_vars)[source]
Get the scaled output expressions of the output variables.