Diagnostics¶
Whether a state-dependent R(x) earns its keep is a question about the states an action can actually reach. A noise that varies only where no policy goes is, for every purpose the filter and the objective have, a constant. probe_model samples the reachable set and reports back a SensorReport: whether R is positive definite at every sample, whether it moves at all, and whether the epistemic value moves with it. The set is sampled, not exhausted, so a negative is evidence rather than proof.
probe_model ¶
probe_model(
model: LinearGaussianModel | ProbeBackend,
belief: Belief,
actions: Sequence[ArrayLike],
*,
tol: float = 1e-12,
) -> SensorReport
Probe a model's sensor over the predicted means a set of actions reaches.
Each action is pushed through the prediction step to get (μ⁻, Σ⁻); the sensor is
linearized at each μ⁻ and the four conditions are evaluated over the resulting
sample. This is the reachable set the conditions are about — vary actions to
widen it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
LinearGaussianModel | ProbeBackend
|
a |
required |
belief
|
Belief
|
the belief to predict from — the shared prior every action starts at. |
required |
actions
|
Sequence[ArrayLike]
|
the candidate actions to sample. |
required |
tol
|
float
|
below this, two noise covariances or two epistemic values count as equal. |
1e-12
|
Returns:
| Type | Description |
|---|---|
SensorReport
|
A |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/cpomdp/diagnostics.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
SensorReport
dataclass
¶
SensorReport(
n_samples: int,
rank: int,
n_observations: int,
full_row_rank: bool,
definite: bool,
indefinite_at: tuple[tuple[float, ...], ...],
non_constant: bool,
noise_spread: float,
epistemic_varies: bool,
epistemic_range: tuple[float, float],
loewner_comparable: bool,
)
What the sampled reachable set says about a model's sensor.
Attributes:
| Name | Type | Description |
|---|---|---|
n_samples |
int
|
how many predicted means were probed. |
rank |
int
|
the rank of |
n_observations |
int
|
the number of observation channels, |
full_row_rank |
bool
|
whether |
definite |
bool
|
whether |
indefinite_at |
tuple[tuple[float, ...], ...]
|
the sampled means where it was not. |
non_constant |
bool
|
whether |
noise_spread |
float
|
the largest pairwise distance between the sampled |
epistemic_varies |
bool
|
whether the epistemic value differed across the samples. |
epistemic_range |
tuple[float, float]
|
its smallest and largest sampled values, in nats. |
loewner_comparable |
bool
|
whether the extreme pair of sampled |
flattens
property
¶
Whether the sampled evidence says the sensor is a constant in disguise.
True when R never moved across the sampled means: the covariance recursion
then never consults the action, so a fixed noise schedule reproduces the agent
and the epistemic term cannot tell two policies apart.
summary ¶
A few lines a human can read, one per condition.
Source code in src/cpomdp/diagnostics.py
A flat LinearGaussianModel and a graph backend reach their predicted means by different routes, so probe_model takes either. ProbeBackend is the three members it needs from the second.
ProbeBackend ¶
Bases: Protocol
The three members probe_model reads off a graph backend.
Structural rather than a name, because three members is what the function requires.
Any backend growing them works, and the diagnostic keeps its one-way dependency on
the backends package. CouplingGraphBackend
satisfies it.