MultilinearSurrogate¶
- class flexops.surrogates.multilinear.MultilinearSurrogate(spec: SurrogateSpec | dict)¶
A constant plus a sum of coefficient * (product of distinct inputs).
The spec is:
{"surrogate_type": "multilinear", "config": { "input_variables": {"flow_out": "m^3/hr", "outlet_state.pressure": "Pa"}, "output_variables": {"power_electrical": "kW"}, "terms": ["flow_out", "flow_out*outlet_state.pressure"]}, "parameters": { "intercept": {"value": 5.0, "fixed": true}, "flow_out": {"value": 0.4, "fixed": true}, "flow_out*outlet_state.pressure": {"value": 1.2e-5, "fixed": true}}}
The parameters are
"intercept"(the constant term, read in the declared output units) plus one scalar per term, named by the term. A free parameter without a value starts at0.0.- config_model¶
alias of
MultilinearConfig
- classmethod make_spec(*, input_variables: dict[str, str], output_variables: dict[str, str], coefficients: dict[str, float], fixed: dict[str, bool] | None = None, provenance: dict[str, Any] | None = None) SurrogateSpec¶
Return a validated multilinear spec.
- Parameters:
input_variables –
{name: units}of every input.output_variables –
{name: units}of the one output.coefficients –
{term: value}; each key other than"intercept"becomes a term, in this order. A missing"intercept"is0.0.fixed –
{name: False}for each parameter to leave free; every other parameter is fixed.provenance – Free-form fit metadata.
- Returns:
The spec.
- Raises:
FlexConfigError – If the result does not match the contract.
- property output_variables: dict[str, str]¶
Return the one declared output variable name and its units.
- classmethod parameter_shapes(config: MultilinearConfig) dict[str, tuple]¶
Return
interceptplus one scalar per term.