Expand description
Fuzzy rules over a reply: what -r rules.toml reads. A policy written over Jev’s answers: each
term reads a probability (a Noul’s probability of yes, one Score level’s or one Choice option’s)
and uses it as the degree to which the term holds. That is a modelling choice, not a fact about
the numbers: a probability of 0.8 that it is hot is not “hot to degree 0.8”. The rules combine
the degrees with AND, OR, NOT and hedges, by fuzzy logic, into a support score per outcome, which
counts as a yes at or over a threshold. A support score is not a probability, and isn’t
calibrated as one: the reply keeps the probabilities.
[logic] # optional
and = "min" # min | product | lukasiewicz
or = "max" # max | probsum | bounded
[decide] # optional
threshold = 0.5
[terms] # the names rules use for the answers
hot = "temp.Hot" # a Score's level, by its text
stormy = "sky.storm" # a Choice's option
raining = "raining" # a Noul, by its id alone
[[rule]]
if = "raining AND NOT SOMEWHAT hot"
then = "raincoat"
weight = 1.0 # optional; the rule's score is multiplied by itOperators are uppercase (AND, OR, NOT, and the hedges VERY, SOMEWHAT, EXTREMELY,
INDEED) and terms are lowercase, so neither can be taken for the other. Hedges and NOT bind
tightest, then AND, then OR, and parentheses group. Rules with the same then are joined by
the file’s OR. OUTPUT IS SET always concludes in a declared [output.OUTPUT].
Before evaluating, every answer the terms read is checked: a probability outside 0 to 1, a distribution that doesn’t add up to 1, or a level or option the question doesn’t have is an error, never clamped into something that looks like an answer.
A rules file is checked against the questions before anything is asked (Rules::parse), so a
term naming a level the question doesn’t have costs no call.
Structs§
- Fired
- One rule’s part in an item’s score.
- Item
- One
then: its score, whether that reaches the threshold, and the rules that gave it. - Logic
- The file’s
[logic]: which AND and which OR. - Outcome
- What the rules made of a reply.
- Output
Value - An output’s crisp value: the centroid of its sets, each clipped at the score its rules give it. The value says where the support lies, not how much there is: a set clipped at 0.01 alone gives the same value as one clipped at 1, so read the sets’ scores before acting on it.
- Rules
- A rules file, parsed and checked against the questions it will read.
- SetScore
- One set of an output: the score its rules clip it at (joined by the file’s OR), and those rules.