rnel.off
¶
Signed evidence and off-opinions (EXPERIMENTAL).
Two layers, deliberately kept apart:
-
EvidenceLedger (sound): reports can be added and later retracted, per source. As long as no source retracts more than it reported, the net evidence (r, s) is non-negative and yields an ordinary Subjective Logic opinion; removing a source is exactly SL cumulative unfusion (Jøsang 2016, ch. 13). A source found to be systematically inverted (it reports the opposite of the truth) is handled by
invert, which moves its evidence to the complement: its reports for x become evidence for not-x. This keeps every quantity in [0, 1]. -
OffOpinion (experimental): if more is retracted than was reported (or evidence is scaled beyond a standard), the components of the opinion can leave [0, 1]. Such values are returned only on request (allow_off=True), always flagged, and are NOT probabilities: when the Beta parameters alpha = r + a W or beta = s + (1 - a) W are not positive, there is no Beta distribution behind them. They are useful as diagnostics (over-retraction, double counting), not for decisions.
OffValueWarning
¶
Bases: UserWarning
Raised when a quantity leaves [0, 1] and is returned as an off-value.
Source code in src/rnel/off.py
25 26 | |
OffOpinion
dataclass
¶
(b, d, u, a) with b + d + u = 1 but components allowed outside [0, 1].
Source code in src/rnel/off.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
b
instance-attribute
¶
d
instance-attribute
¶
u
instance-attribute
¶
a = 0.5
class-attribute
instance-attribute
¶
r = 0.0
class-attribute
instance-attribute
¶
s = 0.0
class-attribute
instance-attribute
¶
W = DEFAULT_W
class-attribute
instance-attribute
¶
projected
property
¶
in_simplex
property
¶
beta_admissible
property
¶
True when a Beta(alpha, beta) density exists: alpha = r + aW > 0 and beta = s + (1 - a)W > 0.
to_opinion()
¶
Source code in src/rnel/off.py
54 55 56 57 | |
EvidenceLedger
dataclass
¶
Evidence about one proposition x, kept per source so that it can be retracted or inverted.
Source code in src/rnel/off.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
W = DEFAULT_W
class-attribute
instance-attribute
¶
a = 0.5
class-attribute
instance-attribute
¶
sources = field(default_factory=dict)
class-attribute
instance-attribute
¶
report(source, for_x=0.0, against_x=0.0)
¶
Source code in src/rnel/off.py
85 86 87 88 89 90 91 | |
retract(source, for_x=0.0, against_x=0.0)
¶
Withdraw reports of a source (e.g. a retracted paper, fake reviews removed).
Source code in src/rnel/off.py
93 94 95 96 97 98 99 100 | |
retract_source(source)
¶
Remove everything a source reported (SL cumulative unfusion of that source).
Source code in src/rnel/off.py
102 103 104 105 106 | |
invert(source, inverted=True)
¶
Mark a source as systematically inverted: its reports for x count as evidence against x and vice versa (positive evidence on the complement, instead of negative evidence).
Source code in src/rnel/off.py
108 109 110 111 112 | |
per_source()
¶
Source code in src/rnel/off.py
114 115 116 117 118 119 120 | |
over_retracted()
¶
Sources that retracted more than they reported (the only way net evidence becomes negative).
Source code in src/rnel/off.py
122 123 124 | |
net()
¶
Source code in src/rnel/off.py
126 127 128 | |
opinion(allow_off=False)
¶
Source code in src/rnel/off.py
130 131 132 133 134 135 136 137 138 139 140 | |
off_from_evidence(r, s, W=DEFAULT_W, a=0.5)
¶
Definition 2.2 of SL applied to signed counts: b = r/S, d = s/S, u = W/S with S = r + s + W (S must be > 0).
Source code in src/rnel/off.py
60 61 62 63 64 65 | |
cumulative_unfusion(fused, removed, W=DEFAULT_W)
¶
Remove the contribution of removed from a cumulative fusion (evidence subtraction). Raises if the
removed opinion carries more evidence than the fused one on either side.
Source code in src/rnel/off.py
143 144 145 146 147 148 149 150 151 | |
offunion(A, B)
¶
Definition 10.1: (max T, min I, min F) on [Psi, Omega].
Source code in src/rnel/off.py
157 158 159 | |
offintersection(A, B)
¶
Definition 10.1: (min T, max I, max F).
Source code in src/rnel/off.py
162 163 164 | |
offcomplement(A, psi=0.0, omega=1.0)
¶
Definition 10.1: C(A) = (F, Psi + Omega - I, T).
Source code in src/rnel/off.py
167 168 169 | |
scaled_and(x, y, sigma)
¶
Theorem 10.4: x AND_sigma y = sigma^-1 (x AND y) on the over-plane T + I + N + F = sigma.
Source code in src/rnel/off.py
172 173 174 175 | |
scaled_or(x, y, sigma)
¶
Source code in src/rnel/off.py
178 179 180 | |
typed_discount(p, x, link)
¶
Definition 6.3 for any real trust p (Theorem 10.5): every component X -> pX, then U_link += 1 - p.
Source code in src/rnel/off.py
183 184 185 186 187 | |
off_rnel_tuple(t=0.0, f=0.0, c=0.0, v=0.0, n=0.0, W=DEFAULT_W, **ik)
¶
Definition 10.7: Definition 8.1 with signed counts (reports minus retracted reports).
Source code in src/rnel/off.py
190 191 192 193 194 195 196 197 | |
retraction_nu(T, I, F, a=0.5)
¶
Definition 4.2: (T, F, I + 1 - S) if S <= 1, (T/S, F/S, I/S) if S > 1; returns (b, d, u, a).
Source code in src/rnel/off.py
200 201 202 203 204 205 | |
projected_via_nu(tuple_, a=0.5)
¶
Definition 4.4: P(x) = b_nu + a u_nu after coarsening (all indeterminacy-type components into I).
Source code in src/rnel/off.py
208 209 210 211 212 213 | |
signed_multiply(x, y, a=0.0)
¶
SL multiplication (Jøsang) on (b, d, u) triples without range checks, same base rate a for both.
Source code in src/rnel/off.py
216 217 218 219 220 221 222 223 | |
signed_comultiply(x, y, a=1.0)
¶
Source code in src/rnel/off.py
226 227 228 229 230 231 232 | |
complement_discount(p, b, d, u, a=0.5)
¶
Alternative to discounting with p < 0 (not in the paper): a source trusted at level |p| whose reports are inverted contributes its opinion about the complement, (d, b, u), discounted by |p|. Stays in the simplex.
Source code in src/rnel/off.py
235 236 237 238 239 240 241 | |