voiage.schema.ValueArray
Container for probabilistic sensitivity analysis net-benefit samples.
Attributes
Section titled “Attributes”frame : pl.DataFrame
Wide Polars frame with one Float64 column per strategy in declared
order (2D surface), or one Array(Float64, n_perspectives) column per
strategy (3D multi-perspective surface). Column names are the strategy
names. Sample count is the frame height.
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_polars
Section titled “from_polars”from_polars([positional or keyword] cls: None = None, [positional or keyword] frame: pl.DataFrame = None, [positional or keyword] perspective_names: list[str] | None = None) -> ValueArrayCreate a ValueArray from a wide Polars frame.
Parameters:
clsframepl.DataFrameperspective_nameslist[str] | None(default:None)
Returns: ValueArray
to_polars
Section titled “to_polars”to_polars([positional or keyword] self: ValueArray = None) -> pl.DataFrameReturn a deep copy of the wide Polars frame.
Parameters:
selfValueArray
Returns: pl.DataFrame
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: np.ndarray | JaxArray = None, [positional or keyword] strategy_names: list[str] | None = None) -> ValueArrayCreate a ValueArray from a numpy or JAX array.
Args: values: A 2D Float64 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:
clsvaluesnp.ndarray | JaxArraystrategy_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: np.ndarray | JaxArray = 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 multi-perspective surface.
Parameters:
clsvaluesnp.ndarray | JaxArraystrategy_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: JaxArray = 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:
clsvaluesJaxArraystrategy_nameslist[str] | None(default:None)
Returns: ValueArray