Simulation Based Inference
Contains the implementations for the simulation-based inference methods
Implements the supported simulation-based inference methods.
- class calisim.sbi.implementation.SimulationBasedInferenceMethod(calibration_func: Callable, specification: SimulationBasedInferenceMethodModel, engine: str = 'sbi', implementation: type[CalibrationWorkflowBase] | CalibrationWorkflowBase | None = None)[source]
The simulation-based inference method class.
- pydantic model calisim.sbi.implementation.SimulationBasedInferenceMethodModel[source]
The simulation-based inference method data model.
- Parameters:
BaseModel (CalibrationModel) – The calibration base model class.
- Config:
arbitrary_types_allowed: bool = True
protected_namespaces: tuple = ()
- Fields:
- field num_simulations: int = 25
The number of simulations to run
- calisim.sbi.implementation.get_implementations() dict[str, str][source]
Get the calibration implementations for simulation-based inference.
- Returns:
- The dictionary of
calibration implementations for simulation-based inference.
- Return type:
Dict[str, str]
SBI
Contains the implementations for simulation-based inference methods using SBI
Implements the supported simulation-based inference methods using the SBI library.
- class calisim.sbi.sbi_wrapper.SBISimulationBasedInference(calibration_func: Callable, specification: CalibrationModel, task: str)[source]
The SBI simulation-based inference method class.
LAMPE
Contains the implementations for simulation-based inference methods using LAMPE
Implements the supported simulation-based inference methods using the LAMPE library.
- class calisim.sbi.lampe_wrapper.LAMPESimulationBasedInference(calibration_func: Callable, specification: CalibrationModel, task: str)[source]
The LAMPE simulation-based inference method class.
- postprocess(samples: Tensor, parameter_spec: list[DistributionModel] | Any | None) Tensor[source]
Reverse normalise the parameters of the simulation. :param samples: The normalised parameters. :type samples: torch.Tensor :param parameter_spec: The parameter specification. :type parameter_spec: list[DistributionModel] | Any | None
- Raises:
ValueError – Error raised when an unsupported distribution is provided.
- Returns:
The denormalised parameters.
- Return type:
torch.Tensor
- preprocess(theta: Tensor, parameter_spec: list[DistributionModel] | Any | None) Tensor[source]
Normalise the parameters of the simulation. :param theta: The simulation parameters. :type theta: torch.Tensor :param parameter_spec: The parameter specification. :type parameter_spec: list[DistributionModel] | Any | None
- Raises:
ValueError – Error raised when an unsupported distribution is provided.
- Returns:
The normalised parameters.
- Return type:
torch.Tensor