Engineering.Reference:26.4.6.3 - Run the changed performer with its joint remaining support
Before testing withdrawal, bind the learned actions to the runner that will execute them and define the assistance rule. For the two familiar unit classes, the candidate uses its learned interpretation. For an unfamiliar unit, the runner reports that it needs the current definition of that unit. Every report needs an observation of the rule in force. Once that evidence is available for this task, further retrieval can stop. Use SYSE.50 for the help decision, SYSE.51 for useful effort and completion reserve, and SYSE.47/.52 for the implemented continuation and input. Requalify those decisions when their performer, input or support changes.
This Python fixture calculates the update and executes subsequent reports. The snapshot passed through current is stipulated current for that task; a real adapter must obtain the corresponding freshness grounds. The calls return read-only reports. The success function computes the finite learned performer’s rate; the earlier table separately supplies the unchanged aided performer’s rates.
from math import exp, log
def sigmoid(x):
return 1.0 / (1.0 + exp(-x))
def loss(theta):
p = [sigmoid(x) for x in theta]
return -(log(p[0]) + log(1.0 - p[1])) / 2.0
def update(theta, eta=4.0):
targets = (1.0, 0.0)
gradient = [(sigmoid(x) - y) / 2.0
for x, y in zip(theta, targets)]
return [x - eta * g for x, g in zip(theta, gradient)]
def success(theta):
return (sigmoid(theta[0]) + 1.0 - sigmoid(theta[1])) / 2.0
theta = [-log(4.0), log(4.0)]
history = [(0, tuple(theta), success(theta))]
for step in range(1, 5):
theta = update(theta)
history.append((step, tuple(theta), success(theta)))
for row in history:
print(row)
assert success(theta) >= 0.85
class RuleSource:
def __init__(self, revision, maximum_seconds):
self.revision = revision
self.maximum_seconds = maximum_seconds
self.calls = 0
def read(self):
self.calls += 1
if self.maximum_seconds is None:
return None
return {"revision": self.revision,
"maximum_seconds": self.maximum_seconds}
def complete(amount, unit, theta, draw, source, current=None):
if unit not in ("ms", "minutes"):
return {"gap": "obtain the current unit definition"}
# These two action bindings are retained execution operations.
if unit == "ms":
seconds = amount / 1000 if draw < sigmoid(theta[0]) else amount
else:
seconds = amount if draw < sigmoid(theta[1]) else amount * 60
if current is None:
current = source.read()
if current is None:
return {"gap": "obtain the current permitted range"}
return {"seconds": seconds, "revision": current["revision"],
"within_range": 0 < seconds <= current["maximum_seconds"]}
old = RuleSource(7, 20)
first = complete(15000, "ms", theta, 0.6, old)
assert first == {"seconds": 15, "revision": 7, "within_range": True}
assert old.calls == 1
new = RuleSource(8, 10)
changed = complete(15000, "ms", theta, 0.6, new)
assert changed == {"seconds": 15, "revision": 8, "within_range": False}
missing = RuleSource(9, None)
assert complete(15000, "ms", theta, 0.6, missing) == {
"gap": "obtain the current permitted range"}
# The fixture supplies this snapshot as current for this task.
fresh = new.read()
calls_before = new.calls
stopped = complete(0.3, "minutes", theta, 0.6, new, current=fresh)
assert stopped == {"seconds": 18, "revision": 8, "within_range": False}
assert new.calls == calls_before
assert complete(500, "ticks", theta, 0.6, new) == {
"gap": "obtain the current unit definition"}
print(first, changed, stopped)
for n in (2, 20, 100):
print(n, {"retain": 4.2*n, "learn": 30+3.1*n,
"converter": 8+3.0*n})
The learned interpretation produces 15 seconds from 15000 ms. Under revision 7 with maximum 20 seconds, the completed report says within range. Under revision 8 with maximum 10 seconds, the same learned operation correctly produces an out-of-range report after consuming the new rule. When the source lacks the permitted range, the assistant reports that it needs the current range. Changing the interpretation weights cannot provide the range. With an already current snapshot, 0.3 minutes becomes 18 seconds and the assistant finishes without another read. For unfamiliar ticks, the assistant reports that it needs the current definition of that unit.
Test the whole candidate on the declared task population and final support conditions through SYSE.46. In the finite model, the two correct-action probabilities can be enumerated exactly. With sampled operating data, retain the sampling, dependence and uncertainty that qualify a claimed rate. Include failed reports, unrecognized inputs, inaccurate help, a changed definition and a formerly retained guide that later becomes necessary. Restore the contribution whose grounds failed; avoid changing the learner merely because the whole report failed.