NumpyLogitBernoulliDistribution¶
- class probly.representation.distribution.numpy_bernoulli.NumpyLogitBernoulliDistribution(array: ndarray)[source]¶
Bases:
NumpyBernoulliDistribution[NumpyLogitBernoulliDistribution],NumpyLogitCategoricalDistribution[NumpyLogitBernoulliDistribution]A Bernoulli distribution represented by class-1 log-odds.
- property T: ShapeResultT¶
The transposed version of the underlying array.
- array: np.ndarray¶
- astype(dtype: DTypeLike, order: Order = 'K', casting: Literal['no', 'equiv', 'safe', 'same_kind', 'unsafe'] = 'unsafe', subok: bool = True, copy: bool = True) OpResultT[source]¶
Cast each protected field using ndarray.astype’s casting and layout options.
- property flags: ArrayFlagsLike¶
The flags of the array.
- property mT: ShapeResultT¶
The transposed version of the underlying array.
- permitted_functions = {<function average>, <function mean>}¶
- permitted_ufuncs = {}¶
- primary_protected_name = 'array'¶
- protected_values(func: Callable | None = None, method: str | None = None) dict[str, NumpyProtectedValue] | None[source]¶
Read effective values, with optional NumPy function or ufunc permissions.
- reshape(*shape: int | tuple[int, ...], order: str = 'C', copy: bool | None = None) ShapeResultT[source]¶
Return a copy with reshaped protected values.
- sample(num_samples: int = 1, rng: Generator | None = None) NumpySample[ndarray][source]¶
Sample from the categorical distribution (NumPy backend).
- property shape: tuple[int, ...]¶
Read the logical shape without collecting fields unless all broadcast.
- to_categorical() NumpyLogitCategoricalDistribution[source]¶
Convert to a two-class categorical distribution.
- transpose(*axes: int | Sequence[int] | None) ShapeResultT[source]¶
Return a transposed version of the NumpySample.
This method implicitly also provides full axis tracking support for - np.moveaxis - np.rollaxis Those functions call out to transpose methods for custom array types.
- Parameters:
axes – The axes to transpose.
- Returns:
A transposed version of the NumpySample.
- type = 'bernoulli'¶
- property unnormalized_probabilities: ndarray¶
Get unnormalized probabilities of the categorical distribution.