PosteriorNetworkDecomposition

class probly.method.posterior_network.PosteriorNetworkDecomposition(distribution: SecondOrderDistributionLike)[source]

Bases: CachingDecomposition, AleatoricEpistemicDecomposition, Generic

Decomposition based on the Posterior Network.

Implements the two uncertainty scoring functions formally proposed by PostNet [CZugnerGunnemann20] in its Sec. 4 (“Metrics”):

  • Aleatoric uncertainty: 1 - max_c (alpha_c / alpha_0), the max-probability complement of the predictive distribution. The paper reports this as the aleatoric confidence score max_c p_bar_c (“Alea. Conf” / “OOD Alea” in every results table); this implementation flips it to a complement so that high values indicate high uncertainty.

  • Epistemic uncertainty: K / alpha_0, the vacuity introduced by [SKK18]. This is monotonically equivalent to the paper’s “OOD Epist” score alpha_0 while being bounded in (0, 1].

The paper does not formally propose a “total uncertainty” scoring function; the predictive entropy used in Fig. 4 of the paper is also not a formal aleatoric metric (it is only used for OOD/OODom histograms). Consequently this decomposition has only aleatoric and epistemic slots, and no canonical notion (both are equally valid).

Parameters:

distribution – A second-order distribution (e.g. a Dirichlet) or a sample from one. The aleatoric component requires a max_probability_complement_of_expected implementation, and the epistemic component requires a vacuity implementation registered for the input type.

property aleatoric: AU

The aleatoric uncertainty of the decomposition.

canonical_notion = None
property components: list[type[Notion]]

The components of the decomposition.

distribution: SecondOrderDistributionLike
property epistemic: EU

The epistemic uncertainty of the decomposition.

get(k[, d]) → D[k] if k in D, else d.  d defaults to None.
get_canonical() → Notion[source]

Return the canonical notion of the decomposition.

get_notion(notion: type[N]) → N[source]

Return the component corresponding to the given notion.

items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
values() → an object providing a view on D's values