matflow.param_classes.surrogate.Surrogate#

class matflow.param_classes.surrogate.Surrogate(X, y, parameter_names=None, model=None, scale=True)#

Bases: ParameterValue

Methods

build_model

dump_element_group_to_HDF5_group

Write a list (from an element group) of parameter values to an HDF5 group.

dump_to_HDF5_group

Write this parameter value to an HDF5 group.

fit

generate_sobol

Wrapper function for scipy.stats.sobol_indices

get_unscaled_data

make_prediction

make_prediction_sobol

perform_inference

prepare_JSON_dump

Prepare this parameter value for serialisation as JSON.

save_from_HDF5_group

Extract a parameter value from an HDF5 group.

save_from_JSON

Extract a parameter value from JSON data.

scale_data

to_dict

Convert to a serialisable dictionary.

Attributes

pytensor_config_cxx

Path to the c++ compiler that Pytensor should use.

build_model(kernel='matern', cross_validate=False, cross_validator=5, scoring='neg_mean_absolute_error', **kwargs)#
classmethod dump_element_group_to_HDF5_group(objs, group)#

Write a list (from an element group) of parameter values to an HDF5 group.

Parameters:
  • objs (list[Self]) –

  • group (HDF5Group) –

dump_to_HDF5_group(group)#

Write this parameter value to an HDF5 group.

Parameters:

group (HDF5Group) –

fit(Y_actual, Y_error, use_std=True, **kwargs)#
generate_sobol(use_fit=False, **kwargs)#

Wrapper function for scipy.stats.sobol_indices

Parameters:
  • n (int) – number of samples

  • **kwargs – additonal parameters

Returns:

SobolResult

Return type:

sobol

get_unscaled_data(unscale_X=True, unscale_y=True)#
make_prediction(X, return_std=False, scalar_output=False)#
make_prediction_sobol(X)#
perform_inference(Y_actual, Y_error, initval=None, use_std=True, **kwargs)#
prepare_JSON_dump()#

Prepare this parameter value for serialisation as JSON.

Return type:

dict[str, Any]

pytensor_config_cxx: ClassVar[str | None] = None#

Path to the c++ compiler that Pytensor should use. If setting, this should be done before an instance is created.

classmethod save_from_HDF5_group(group, param_id, workflow)#

Extract a parameter value from an HDF5 group.

Parameters:
  • group (HDF5Group) –

  • param_id (int) –

  • workflow (Workflow) –

classmethod save_from_JSON(data, param_id, workflow)#

Extract a parameter value from JSON data.

Parameters:
scale_data(scale_X=True, scale_y=True)#
to_dict()#

Convert to a serialisable dictionary.