Skip to main content

mdl

Function mdl 

Source
pub fn mdl(grammar: &Grammar, data: &[&str]) -> f64
Expand description

Computes the deterministic two-part MDL score for grammar and data.

L(G) is size_symbols(G) * ceil(log2(alphabet(G))), where the alphabet is the distinct set of rule names, terminals, character primitives, and grammar operators. L(D | G) uses a fixed deterministic code: accepted examples cost one emitted-symbol bit per Unicode scalar plus a stop bit; rejected examples fall back to their UTF-8 byte length plus a 64-bit escape penalty.