Skip to content

solvi.rulelist

A readable rule list learned from examples (System.learn_rule): "if feature then answer", deterministic and replayable. solvi.rules up to 0.7.

Rules learned from examples instead of hand-written ones: an ordered "if feature then answer" list (a decision list) that can be read and audited. Features are built from computed facts: words of a string, leading digits of numbers in a string (codes), rounded numbers, category values. Fitting is greedy: at each step take the rule with the best precision on the not-yet-covered examples (with support ≥ min_support) while precision ≥ min_precision; last comes the default answer (the most frequent among the rest).

RuleList

RuleList(facts, min_support=3, min_precision=0.8, max_rules=40)

fit

fit(rows, answers)

Learn the list from rows of facts and their answers; a second fit starts over (it replaces the list).

words

words(text)

The upper-cased words and numbers of a text, in any script: runs of letters, digits, combining marks and apostrophes ("ул. Северная, 12" → УЛ, СЕВЕРНАЯ, 12; "Zürich" → ZÜRICH).