Skip to content

voiage.schema.ValueArray

Container for probabilistic sensitivity analysis net-benefit samples.

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.

>>> 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)

from_polars([positional or keyword] cls: None = None, [positional or keyword] frame: pl.DataFrame = None, [positional or keyword] perspective_names: list[str] | None = None) -> ValueArray

Create a ValueArray from a wide Polars frame.

Parameters:

  • cls
  • frame pl.DataFrame
  • perspective_names list[str] | None (default: None)

Returns: ValueArray

to_polars([positional or keyword] self: ValueArray = None) -> pl.DataFrame

Return a deep copy of the wide Polars frame.

Parameters:

  • self ValueArray

Returns: pl.DataFrame

copy([positional or keyword] self: ValueArray = None) -> ValueArray

Return a deep copy of the ValueArray.

Parameters:

  • self ValueArray

Returns: ValueArray

get_strategy_index([positional or keyword] self: ValueArray = None, [positional or keyword] strategy_name: str = None) -> int

Return the integer index for a strategy name.

Parameters:

  • self ValueArray
  • strategy_name str

Returns: int

slice_by_strategies([positional or keyword] self: ValueArray = None, [positional or keyword] strategy_names: Sequence[str] = None) -> ValueArray

Return a new ValueArray containing only the requested strategies.

Parameters:

  • self ValueArray
  • strategy_names Sequence[str]

Returns: ValueArray

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) -> ValueArray

Create 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

ValueArray: A new ValueArray instance

Parameters:

  • cls
  • values np.ndarray | JaxArray
  • strategy_names list[str] | None (default: None)

Returns: ValueArray

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) -> ValueArray

Create a multi-perspective ValueArray from a 3D array.

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.

ValueArray ValueArray with a multi-perspective surface.

Parameters:

  • cls
  • values np.ndarray | JaxArray
  • strategy_names list[str] | None (default: None)
  • perspective_names list[str] | None (default: None)

Returns: ValueArray

from_jax([positional or keyword] cls: None = None, [positional or keyword] values: JaxArray = None, [positional or keyword] strategy_names: list[str] | None = None) -> ValueArray

Create 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

ValueArray: A new ValueArray instance

Parameters:

  • cls
  • values JaxArray
  • strategy_names list[str] | None (default: None)

Returns: ValueArray