voiage.schema.ValueArray
Container for probabilistic sensitivity analysis net-benefit samples.
Attributes
Section titled “Attributes”dataset : xarray.Dataset
Canonical xarray Dataset with n_samples and n_strategies
dimensions and a net_benefit data variable.
Examples
Section titled “Examples”>>> import numpy as np >>> from voiage.schema import ValueArray >>> values = np.array([[10.0, 12.0], [11.0, 9.5]]) >>> va = ValueArray.from_numpy(values, [“A”, “B”]) >>> va.n_samples, va.n_strategies (2, 2)
Methods
Section titled “Methods”from_dataset
Section titled “from_dataset”from_dataset([positional or keyword] cls: None = None, [positional or keyword] dataset: xr.Dataset = None) -> ValueArrayCreate a ValueArray from a canonical xarray Dataset.
Parameters:
clsdatasetxr.Dataset
Returns: ValueArray
to_dataset
Section titled “to_dataset”to_dataset([positional or keyword] self: ValueArray = None) -> xr.DatasetReturn a deep copy of the canonical xarray Dataset.
Parameters:
selfValueArray
Returns: xr.Dataset
copy([positional or keyword] self: ValueArray = None) -> ValueArrayReturn a deep copy of the ValueArray.
Parameters:
selfValueArray
Returns: ValueArray
get_strategy_index
Section titled “get_strategy_index”get_strategy_index([positional or keyword] self: ValueArray = None, [positional or keyword] strategy_name: str = None) -> intReturn the integer index for a strategy name.
Parameters:
selfValueArraystrategy_namestr
Returns: int
slice_by_strategies
Section titled “slice_by_strategies”slice_by_strategies([positional or keyword] self: ValueArray = None, [positional or keyword] strategy_names: Sequence[str] = None) -> ValueArrayReturn a new ValueArray containing only the requested strategies.
Parameters:
selfValueArraystrategy_namesSequence[str]
Returns: ValueArray
from_numpy
Section titled “from_numpy”from_numpy([positional or keyword] cls: None = None, [positional or keyword] values: Union[np.ndarray, jnp.ndarray] = None, [positional or keyword] strategy_names: list[str] | None = None) -> ValueArrayCreate a ValueArray from a numpy or JAX array.
Args: values: A 2D array of shape (n_samples, n_strategies). Supports both NumPy and JAX arrays. strategy_names: Optional list of strategy names
Returns
Section titled “Returns”ValueArray: A new ValueArray instance
Parameters:
clsvaluesUnion[np.ndarray, jnp.ndarray]strategy_nameslist[str] | None(default:None)
Returns: ValueArray
from_numpy_perspectives
Section titled “from_numpy_perspectives”from_numpy_perspectives([positional or keyword] cls: None = None, [positional or keyword] values: Union[np.ndarray, jnp.ndarray] = None, [positional or keyword] strategy_names: list[str] | None = None, [positional or keyword] perspective_names: list[str] | None = None) -> ValueArrayCreate a multi-perspective ValueArray from a 3D array.
Parameters
Section titled “Parameters”values : numpy.ndarray or jax.numpy.ndarray
Net-benefit values with shape
(n_samples, n_strategies, n_perspectives).
strategy_names : list[str], optional
Strategy labels aligned to the second dimension.
perspective_names : list[str], optional
Perspective labels aligned to the third dimension.
Returns
Section titled “Returns”ValueArray ValueArray with a perspective dimension.
Parameters:
clsvaluesUnion[np.ndarray, jnp.ndarray]strategy_nameslist[str] | None(default:None)perspective_nameslist[str] | None(default:None)
Returns: ValueArray
from_jax
Section titled “from_jax”from_jax([positional or keyword] cls: None = None, [positional or keyword] values: jnp.ndarray = None, [positional or keyword] strategy_names: list[str] | None = None) -> ValueArrayCreate a ValueArray from a JAX array.
Args: values: A 2D JAX array of shape (n_samples, n_strategies) strategy_names: Optional list of strategy names
Returns
Section titled “Returns”ValueArray: A new ValueArray instance
Parameters:
clsvaluesjnp.ndarraystrategy_nameslist[str] | None(default:None)
Returns: ValueArray