gemseo_calibration

Show inherited members

calibrator module

A discipline evaluating the quality of another one with respect to reference data.

class gemseo_calibration.calibrator.CalibrationMeasure(output, measure, mesh, weight)

Bases: tuple

Create new instance of CalibrationMeasure(output, measure, mesh, weight)

measure

Alias for field number 1

mesh

Alias for field number 2

output

Alias for field number 0

weight

Alias for field number 3

class gemseo_calibration.calibrator.Calibrator(disciplines, input_names, control_outputs, parameter_names, formulation='MDF', **formulation_options)[source]

Bases: MDOScenarioAdapter

A discipline with parameters calibrated from reference input-output data.

When it is executed from parameters values, it computes the calibration measure with respect to the reference data, provided through the CalibrationDiscipline.set_reference_data() method.

Initialize self. See help(type(self)) for accurate signature.

Parameters:
  • disciplines (MDODiscipline | list[MDODiscipline]) – The disciplines whose parameters must be calibrated from the reference data.

  • input_names (str | Iterable[str]) – The names of the inputs to be considered for the calibration.

  • control_outputs (CalibrationMeasure | Sequence[CalibrationMeasure]) – The names of the outputs used to calibrate the disciplines with the name of the calibration measure and the corresponding weight comprised between 0 and 1 (the weights must sum to 1). When the output is a 1D function discretized over an irregular mesh, the name of the mesh can be provided. E.g. CalibrationMeasure(output="z", measure="MSE") CalibrationMeasure(output="z", measure="MSE", weight=0.3) or CalibrationMeasure(output="z", measure="MSE", mesh="z_mesh") Lastly, CalibrationMeasure can be imported from gemseo-calibration.scenario.

  • parameter_names (str | Iterable[str]) – The names of the parameters to be calibrated.

  • formulation (str) –

    The name of a formulation to manage the multidisciplinary coupling.

    By default it is set to “MDF”.

  • **formulation_options (Any) – The options of the formulation.

Raises:

ValueError – If both reset_x0_before_opt and set_x0_before_opt are True.

add_measure(control_outputs)[source]

Create a new calibration measure and add it to the outputs of the adapter.

Parameters:

control_outputs (CalibrationMeasure | Iterable[CalibrationMeasure]) – The names of the outputs used to calibrate the disciplines with the name of the calibration measure and the corresponding weight comprised between 0 and 1 (the weights must sum to 1). When the output is a 1D function discretized over an irregular mesh, the name of the mesh can be provided. E.g. CalibrationMeasure(output="z", measure="MSE") CalibrationMeasure(output="z", measure="MSE", weight=0.3) or CalibrationMeasure(output="z", measure="MSE", mesh="z_mesh") Lastly, CalibrationMeasure can be imported from gemseo-calibration.scenario.

Returns:

The name of the calibration measure applied to the outputs.

Return type:

tuple[str, list[str]]

set_reference_data(reference_data)[source]

Pass the reference data to the scenario and to the measures.

Parameters:

reference_data (DataType) – The reference data with which to compare the discipline.

Return type:

None

cache: AbstractCache | None

The cache containing one or several executions of the discipline according to the cache policy.

data_processor: DataProcessor

A tool to pre- and post-process discipline data.

databases: list[Database]

The copies of the scenario databases after execution.

exec_for_lin: bool

Whether the last execution was due to a linearization.

input_grammar: BaseGrammar

The input grammar.

jac: MutableMapping[str, MutableMapping[str, ndarray | csr_array | JacobianOperator]]

The Jacobians of the outputs wrt inputs.

The structure is {output: {input: matrix}}.

keep_opt_history: bool

Whether to keep databases copies after each execution.

property maximize_objective_measure: bool

Whether to maximize the calibration measure related to the objectives.

name: str

The name of the discipline.

output_grammar: BaseGrammar

The output grammar.

post_optimal_analysis: PostOptimalAnalysis

The post-optimal analysis.

re_exec_policy: ReExecutionPolicy

The policy to re-execute the same discipline.

property reference_data: DataType

The reference data used for the calibration.

residual_variables: dict[str, str]

The output variables mapping to their inputs, to be considered as residuals; they shall be equal to zero.

run_solves_residuals: bool

Whether the run method shall solve the residuals.

scenario: Scenario

The scenario to be adapted.