voiage.schema module
Core data structures for voiage.
These structures are designed to hold and manage data used in Value of Information analyses. They leverage Python’s dataclasses for type hinting and validation where appropriate, and are intended to work seamlessly with NumPy and Pandas/xarray.
- class voiage.schema.ValueArray(dataset: Dataset)[source]
Bases:
objectA container for net benefit values from a PSA.
- dataset: Dataset
- classmethod from_numpy(values: ndarray | Array, strategy_names: List[str] | None = None) ValueArray[source]
Create a ValueArray from a numpy or JAX array.
- Parameters:
values – A 2D array of shape (n_samples, n_strategies). Supports both NumPy and JAX arrays.
strategy_names – Optional list of strategy names
- Returns:
ValueArray
- Return type:
A new ValueArray instance
- classmethod from_jax(values: Array, strategy_names: List[str] | None = None) ValueArray[source]
Create a ValueArray from a JAX array.
- Parameters:
values – A 2D JAX array of shape (n_samples, n_strategies)
strategy_names – Optional list of strategy names
- Returns:
ValueArray
- Return type:
A new ValueArray instance
- class voiage.schema.ParameterSet(dataset: Dataset)[source]
Bases:
objectA container for parameter samples from a PSA.
- dataset: Dataset
- classmethod from_numpy_or_dict(parameters: ndarray | Dict[str, ndarray] | Array | Dict[str, Array]) ParameterSet[source]
Create a ParameterSet from a numpy/JAX array or dictionary.
- Parameters:
parameters – Either a 2D array of shape (n_samples, n_parameters) or a dictionary mapping parameter names to 1D arrays. Supports both NumPy and JAX arrays.
- Returns:
ParameterSet
- Return type:
A new ParameterSet instance
- classmethod from_jax(parameters: Array | Dict[str, Array]) ParameterSet[source]
Create a ParameterSet from a JAX array or dictionary.
- Parameters:
parameters – Either a 2D JAX array of shape (n_samples, n_parameters) or a dictionary mapping parameter names to 1D JAX arrays
- Returns:
ParameterSet
- Return type:
A new ParameterSet instance
- class voiage.schema.DecisionOption(name: str, sample_size: int)[source]
Bases:
objectRepresents a single arm in a clinical trial design.
- Raises:
InputError – If name is not a non-empty string or sample_size is not a positive integer.
- class voiage.schema.TrialDesign(arms: List[DecisionOption])[source]
Bases:
objectSpecifies the design of a proposed trial for EVSI calculations.
- arms
A list of DecisionOption objects that together define the trial.
- Type:
List[DecisionOption]
- Raises:
InputError – If arms is not a non-empty list of DecisionOption objects, or if any of the arm names are duplicated.
- arms: List[DecisionOption]
- class voiage.schema.PortfolioStudy(name: str, design: TrialDesign, cost: float)[source]
Bases:
objectRepresents a single candidate study within a research portfolio.
- design
The TrialDesign object specifying the study’s design.
- Type:
- Raises:
InputError – If inputs are of the wrong type or cost is negative.
- design: TrialDesign
- class voiage.schema.PortfolioSpec(studies: List[PortfolioStudy], budget_constraint: float | None = None)[source]
Bases:
objectDefines a portfolio of candidate research studies for optimization.
- studies
A list of PortfolioStudy objects representing the candidate studies.
- Type:
List[PortfolioStudy]
- budget_constraint
The overall budget limit for the portfolio. Defaults to None.
- Type:
Optional[float], optional
- Raises:
InputError – If studies is not a non-empty list of PortfolioStudy objects, if study names are duplicated, or if budget_constraint is negative.
- studies: List[PortfolioStudy]
- class voiage.schema.DynamicSpec(time_steps: Sequence[float])[source]
Bases:
objectSpecification for dynamic or sequential VOI analyses.
- time_steps
A sequence of time points (e.g., years from present) at which decisions or data accrual occur.
- Type:
Sequence[float]
- Raises:
InputError – If time_steps is not a non-empty sequence of numbers.