romcomma.gsa.models.GSA§

class GSA(gp, kind, m=-1, is_error_calculated=False, **kwargs)[source]§

Bases: Model

Class encapsulating a generic Sobol calculation.

Parameters:
  • gp (GPR) –

  • kind (GSA.Kind) –

  • m (int) –

  • is_error_calculated (bool) –

  • kwargs (Any) –

__init__(gp, kind, m=-1, is_error_calculated=False, **kwargs)[source]§

Perform a general GSA. The object created is single use and disposable: the constructor performs and records the entire GSA and the constructed object is basically useless once constructed.

Parameters:
  • gp (GPR) – The underlying Gaussian Process.

  • kind (Kind) – The kind of index to calculate - first order, closed or total.

  • m (int) – The final index of the reduced model. For a single calculation it is required that 0 &le m &lt gp.M. Any m outside this range results the Sobol index of kind being calculated for all m in range(1, M+1).

  • is_error_calculated (bool) – Whether to calculate the standard error on the Sobol index. This is a memory intensive calculation, so leave this flag False unless you are sure you need errors

  • **kwargs (Any) – The calculation meta to override META.

Methods

__init__(gp, kind[, m, is_error_calculated])

Perform a general GSA.

calibrate([method])

Perform a generic GSA calculation.

read_meta()

write_meta(meta)

Attributes

ALL_KINDS

META

calibrator

The object to do the calculations, whose marginalise(m) method returns a dict of results.

data

folder

class Kind(value)[source]§

Bases: IntEnum

Enum to specify the kind of Sobol index to calculate.

abstract property calibrator: Calibrator§

The object to do the calculations, whose marginalise(m) method returns a dict of results.

calibrate(method=None, **kwargs)[source]§

Perform a generic GSA calculation. This method should be overriden by specific subclasses, and called via super() as a matter of priority.

Parameters:

method (str | None) – Not used.

Return type:

Dict[str, Any]

Returns: The results of the calculation, as a labelled dictionary of tf.Tensors.

class Data(folder, **kwargs)§

Bases: Data

This is a placeholder which must be overridden in any implementation.

Parameters:
  • folder (Path | str) –

  • kwargs (Data.Matrix) –

class NamedTuple(NotImplemented=array([['NotImplemented']], dtype='<U14'))§

Bases: NamedTuple

A NamedTuple of data. Must be overridden.

Parameters:

NotImplemented (Frame | DataFrame | ndarray | Tensor) –

NotImplemented: Frame | DataFrame | ndarray | Tensor§

NamedTuple can have any number of members.

count(value, /)§

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)§

Return first index of value.

Raises ValueError if the value is not present.

static copy(src_folder, dst_folder)§

Returns a copy of src_folder at dst_folder, deleting anything existing at the destination.

Parameters:
  • src_folder (Path | str) –

  • dst_folder (Path | str) –

Return type:

Path

static delete(folder)§

Returns a non-existent folder.

Parameters:

folder (Path | str) –

Return type:

Path

static empty(folder)§

Returns an empty folder.

Parameters:

folder (Path | str) –

Return type:

Path

move(dst_folder)§

Move self to dst_folder.

Parameters:

dst_folder (Path | str) – The folder to move to. If this exists, it will be emptied.

Return type:

Data

Returns: self for chaining calls.

classmethod read(folder, **kwargs)§

Read Data from folder.

Parameters:
  • folder (Path | str) – The folder to record the data. Must exist

  • **kwargs (Frame | DataFrame | ndarray | Tensor) – key=ordinate initial pairs of NamedTuple fields, precisely as in NamedTuple(**kwargs). Missing fields receive their defaults, so Data(folder) is the default Data.

Return type:

Data

Returns: The Data stored in folder.

META = None§