Skip to content

Discretization ​

Reduction eliminates continuous nodes, so a continuous node's posterior cannot be recovered afterward. To keep evidence observable on a continuous node and to let it enter discrete inference, it can be discretized [1]: its support is partitioned at a list of edges into a discrete node plus a conditioned continuous remainder. The strategy is attached to the node and depends on its position:

  • a root carries an ExactDiscretization: the discrete probabilities follow exactly from the node's distribution, because the marginal is known;

  • a child carries an ApproximatedDiscretization: the marginal is not generally available, so the tails are approximated (a uniform assumption over each bounded discretization-interval and an exponential assumption, whose scale is the strategy's second argument, over an unbounded one).

Both strategies also carry two keyword settings, technique and mesh, which decide how the probability mass of a discretization-interval is obtained when the entry is a ProbabilityBox and are ignored otherwise; they are described under Imprecise node below.

Throughout, a discretization-interval means one cell of that partition — never an Interval entry, which is a different thing — and xik−, xik+ denote the lower and upper edges of the k-th one.

Precise node ​

The scheme follows [1]. The node is replaced by a discrete surrogate, carrying one state per discretization-interval, and a continuous residual Xi′, carrying what is left of the variable inside the discretization-interval that was observed.

The discrete surrogate. The probability of state k is the mass the node's CDF puts on the k-th discretization-interval,

pik=FXi(xik+)−FXi(xik−).

On a root this is exact, FXi being the node's own marginal. On a child the same difference is taken once per parent-state scenario, from that scenario's distribution, so the surrogate inherits the node's parents.

The continuous residual. Which form the residual takes depends on the node's position, not on FXi.

A root conditions its own CDF on the discretization-interval, exactly:

FXi′(xi∣k)={0xi≤xik−,FXi(xi)−FXi(xik−)FXi(xik+)−FXi(xik−)xik−≤xi≤xik+,1xi≥xik+.

A child cannot use the (unknown) marginal, so each bounded discretization-interval is filled with a uniform assumption,

FXi′(xi∣k)={0xi≤xik−,xi−xik−xik+−xik−xik−≤xi≤xik+,1xi≥xik+,

and each unbounded tail with an exponential assumption of scale s (the scale argument), pointing away from the discretization-interval's one finite edge. Above a lower edge xik−,

FXi′(xi∣k)={0xi≤xik−,1−exp[−(xi−xik−)/s]xi>xik−,

and, mirrored, below an upper edge xik+,

FXi′(xi∣k)={exp[−(xik+−xi)/s]xi≤xik+,1xi>xik+.

A larger s is a longer tail: it is the exponential's scale, so the residual sits a mean distance s beyond the finite edge. Straub's formulation uses the rate 1/s instead; the family of tails is the same either way.

julia
Tr = ContinuousNode(:Tr, Normal(), ExactDiscretization([-2.0, 0.0, 2.0]))   # root
ContinuousNode: Tr
Parents: none
Discretization: ExactDiscretization
  Intervals: -2.0, 0.0, 2.0
Type: Precise
Support: [-Inf, Inf]

1×1 DataFrame
 Row │ Π                             
     │ Union…                        
─────┼───────────────────────────────
   1 │ Normal{Float64}(μ=0.0, σ=1.0)
julia
# child: discretization-interval edges plus the exponential tail scale (here 1.5)
Cd = ContinuousNode(:Cd, [:W], ApproximatedDiscretization([-1.0, 0.0, 1.0], 1.5))
ContinuousNode: Cd
Parents: W
Discretization: ApproximatedDiscretization
  scale: 1.5
  Intervals: -1.0, 0.0, 1.0
Type: Precise

0×2 DataFrame
 Row │ W       Π      
     │ Symbol  Union… 
─────┴────────────────

Imprecise node ​

When the node is imprecise the same partition is used, and the split into surrogate and residual is the same; only the surrogate's probabilities change shape, becoming intervals rather than numbers.

The discrete surrogate. The mass wanted is the same, pik=FXi(xik+)−FXi(xik−), but a probability box is not one CDF: it is a family {Fθ:θ∈Θ}, each member precise, indexed by a parameter box Θ. Every member assigns its own mass to the interval, so the mass is itself an interval: the range of that mass over the family,

pik=[minθ∈Θ(Fθ(xik+)−Fθ(xik−)),maxθ∈Θ(Fθ(xik+)−Fθ(xik−))].

This is the default, selected by technique = :optimised, and the two bounds are found by direct search over Θ (MeshAdaptiveDirectSearch), one member of the family at a time, down to a terminal mesh size of mesh. A smaller mesh is tighter and slower.

Evaluating one member at a time is what makes the result correct, and the two shortcuts one might reach for instead are both wrong. The p-box's own envelopes F― and F― are built pointwise over Θ, so F―(xik+) and F―(xik−) may be attained by different members; differencing them mixes two distributions and bounds the mass of neither. And the mass need not be monotone in θ, so evaluating only the corners of Θ misses an interior optimum — for a Normal with an interval mean, the mass of a discretization-interval is largest when the mean sits at its midpoint, which is an interior point of Θ.

When the family is not described by a parameter box, or the search is too slow, technique = :distribution_free differences opposite envelopes instead,

pik=[max(0,F―(xik+)−F―(xik−)),min(1,F―(xik+)−F―(xik−))],

which is valid for any CDF lying between the envelopes. On a parametric p-box it therefore encloses the range above: never tighter, usually wider, and equal only on a discretization-interval where the two opposite envelopes happen to be attained by the same member — on a tail, say, where the mass is monotone in θ. The clamps are not cosmetic: the lower expression goes negative as soon as the envelopes are far apart, and an Interval only rejects a lower bound above its upper one, so a negative probability would otherwise pass. mesh is unused here.

Both settings live on the discretization strategy, so they are chosen per node, and both are consulted only for a probability-box entry — a precise distribution and a bare interval ignore them.

Parametric probability boxes only, for now

The only probability box that can be written as a node's entry is a parametric one: a ProbabilityBox is a distribution family plus a box of parameter values, so every member of it belongs to that family. A distribution-free box — any CDF running between two envelopes, with no family behind it — has no dedicated type yet; it is planned for UncertaintyQuantification.jl. Two things follow from that.

First, a continuous functional node fed by an imprecise parent produces exactly such a distribution-free object, which is why it is kept as a lower/upper pair of empirical CDFs and cannot itself be discretized — see Continuous Functional nodes.

Second, technique = :distribution_free is the method those boxes will need once they exist, because it assumes nothing beyond the envelopes. Until then every p-box reaching it is parametric, and on a parametric p-box it is always an enclosure rather than the answer: correct, cheaper, and no tighter than :optimised on any discretization-interval.

For a bare interval entry no CDF is available at all — only the support — so every discretization-interval receives the vacuous mass pik=[0,1]. Either way the surrogate node becomes imprecise (credal), and that is what carries the imprecision into inference.

Vacuous masses and conditioning

A node discretized from a bare interval is vacuous: masses of [0,1] on every discretization-interval constrain nothing beyond summing to one, so the node's credal set is the whole probability simplex over its states and its extreme points are the degenerate distributions putting all the mass on a single discretization-interval. Evidence on such a node then has probability zero under some of those extreme points, and meaningful bounds are only obtained under regular extension — see Credal inference. A ProbabilityBox can narrow these mass intervals, but it avoids zero-probability extremes only when the lower mass of the observed discretization-interval is strictly positive.

The continuous residual. The formulas are exactly the ones given for a precise node, and as there it is the node's position that selects them — the entry's imprecision plays no part.

A root conditions its entry on the discretization-interval, which preserves whatever kind of entry it was: a distribution is truncated, a probability box is rebuilt on the narrower support and stays a box, and a bare Interval becomes the sub-interval [xik−,xik+]. A child uses the uniform or exponential-tail approximation unchanged, so its residual is a precise distribution however imprecise the entry was.

The asymmetry is deliberate: on a root the imprecision lives in both the surrogate probabilities and the residual; on a child it is pushed entirely into the surrogate's interval probabilities, leaving a precise residual. That is why an imprecise child feeding a functional node needs a single-loop simulation — the imprecision has moved into the discrete surrogate and no longer reaches the functional node as an input.

julia
# imprecise root: an interval distribution, discretized exactly
Ti = ContinuousNode(:Ti, Interval(-2.0, 2.0), ExactDiscretization([-2.0, 0.0, 2.0]))
ContinuousNode: Ti
Parents: none
Discretization: ExactDiscretization
  Intervals: -2.0, 0.0, 2.0
Type: Imprecise
Support: [-2.0, 2.0]

1×1 DataFrame
 Row │ Π           
     │ Union…      
─────┼─────────────
   1 │ [-2.0, 2.0]
julia
# imprecise child: an interval entry plus the exponential tail scale
Ci = ContinuousNode(:Ci, [:W], ApproximatedDiscretization([-1.0, 0.0, 1.0], 1.5))
Ci[:W => :sunny] = Interval(-1.0, 1.0)
Ci
ContinuousNode: Ci
Parents: W
Discretization: ApproximatedDiscretization
  scale: 1.5
  Intervals: -1.0, 0.0, 1.0
Type: Imprecise
Support: [-1.0, 1.0]

1×2 DataFrame
 Row │ W       Π           
     │ Symbol  Union…      
─────┼─────────────────────
   1 │ sunny   [-1.0, 1.0]

A probability-box root, whose discretization-interval masses are optimised over the parameter box at the default mesh:

julia
pbox = ProbabilityBox{Normal}(Dict(:μ => Interval(0.0, 1.0), :σ => 1))
Tp = ContinuousNode(:Tp, pbox, ExactDiscretization([-1.0, 0.0, 1.0]))
ContinuousNode: Tp
Parents: none
Discretization: ExactDiscretization
  Intervals: -1.0, 0.0, 1.0
Type: Imprecise
Support: [-Inf, Inf]

1×1 DataFrame
 Row │ Π                                 
     │ Union…                            
─────┼───────────────────────────────────
   1 │ ProbabilityBox{Normal}(Dict{Symb…

The same p-box taking the enclosure instead. A node reports these settings only when they depart from the defaults, so nothing extra appears above and a line does here; a non-default mesh shows up the same way:

julia
Tf = ContinuousNode(:Tf, pbox, ExactDiscretization([-1.0, 0.0, 1.0]; technique = :distribution_free))
ContinuousNode: Tf
Parents: none
Discretization: ExactDiscretization
  Intervals: -1.0, 0.0, 1.0
  P-box mass: distribution_free
Type: Imprecise
Support: [-Inf, Inf]

1×1 DataFrame
 Row │ Π                                 
     │ Union…                            
─────┼───────────────────────────────────
   1 │ ProbabilityBox{Normal}(Dict{Symb…