mbi.LinearMeasurement

class mbi.LinearMeasurement(noisy_measurement: Array | ndarray | bool | number | bool | int | float | complex, clique: tuple[str | int, ...], stddev: float = 1.0, query: Callable[[Factor], Array] = DatavectorQuery(use_for_total_estimation=True))[source]

Bases: object

A class for representing a private linear measurement of a marginal.

noisy_measurement

The noisy measurement of the marginal.

Type:

jax.Array | numpy.ndarray | numpy.bool | numpy.number | bool | int | float | complex

clique

The clique (a tuple of attribute names) defining the marginal.

Type:

tuple[str | int, …]

stddev

The standard deviation of the noise added to the measurement.

Type:

float

query

A linear function that, when applied to a Factor, extracts a

Type:

collections.abc.Callable[[mbi.factor.Factor], jax.Array]

a vector with the same shape and interpretation as `noisy_measurement`.

Methods

__init__

compress

Compress this measurement by merging domain values.

Attributes

query

stddev

noisy_measurement

clique

noisy_measurement: Array | ndarray | bool | number | bool | int | float | complex
clique: tuple[str | int, ...]
stddev: float = 1.0
query: Callable[[Factor], Array] = DatavectorQuery(use_for_total_estimation=True)
compress(mapping: Mapping[Any, ndarray], domain: Domain) → LinearMeasurement[source]

Compress this measurement by merging domain values.

Parameters:
  • mapping – Maps attribute names to 1D integer arrays. mapping[attr][i] gives the compressed value for original value i.

  • domain – The full dataset domain (needed to reshape the measurement vector into the clique’s shape).

Returns:

A new LinearMeasurement over the compressed domain.