Skip to content

grm-core 0.4.0: the GRM machine

Choose a tag to compare

@innermost47 innermost47 released this 11 Nov 21:42
· 8 commits to main since this release

A network that is the program, the memory and the calculator at once.

New

The GRM machine (vm/)

A virtual machine that is one GRM network. Every node and every relation is its own small processor, talking only
to its neighbours and working only when one of them has something new to say (Gaussian belief propagation).

  • Starts blank, or from its memory. It is born with a small base and puts itself to sleep in vm/memory.json when
    it stops; the next session goes on from where it ended, without solving anything again.
  • GRML, the Global Relational Model Language (docs/GRML.md): a reference of every word, a
    tutorial in eleven steps and example programs and data in vm/programs/ (hello, units, a loop, Fibonacci, a thermostat, a
    network called as a function, learning a mean, learning a line, a Minsky machine), each one run by the tests.
  • Turing complete. Variables the network holds until they are written again (var, set x = x + 1
    at each tick: loops), relations that hold only while conditions hold (when: choices). Any Minsky machine is
    written in it; the tests run addition and multiplication.
  • Sums are multiplications. A signed quantity is the exponent of a positive one (e^x1 = e^x0 · (e^v)^dt); a
    converter ties a positive quantity to its signed twin. Terms that multiply free nodes (k · x) or raise them to a
    power are redrawn by the relation itself around where it stands.
  • Learning from files. load data.csv / .json gives the rows to the inputs, one tick a row. Weights (learn)
    that share a relation learn together, links included: the least squares exactly for a line (100 noisy points of
    y = 3x + 2: k = 2.99943, c = 2.02211; four exact rows of y = 2x + 1: 2 and 1).
  • Relations and nodes it makes by itself (with pygrm 0.3.0, pygrm.discover), after every file and at night,
    only where the network does not tie its inputs yet, the user told, not asked:
    • power laws, straight lines, exponentials and logarithms (a ln converter), sums built on products (each
      product its own node: E = 0.5 m v² + 9.81 m h);
    • growths, decays and oscillations from one moment to the next, their past held in variables: given a damped wave
      (period 25), the machine finds it and carries it on when the data stops;
    • a node nobody mentioned: a hidden variable with its own law when a relation's misses follow each other (a slow
      drift: surprise from 26 sigma to 0.3), a constant when they stay on the same side;
    • the constants of everything found go on learning. Noise gives nothing.
  • No node written twice. A routine of its own, after each file and at night, fuses what is one thing under two
    names: two inputs that agree row by row; an input that is the inverse of another (one node, fuse A B inverse);
    an input that holds still at the value of a node known to 1 % (a column
    g at 9.8 becomes earth_gravity; price at 70 does not become human_mass, known to 20 %). Old names keep
    reaching the fused node. fuse A B by hand.
  • Inspired by the brain. Weights that know how sure they are (Aitchison et al., synaptic plasticity as Bayesian
    inference); a surprise, the prediction errors of the relations that hear the inputs (predictive coding, Rao &
    Ballard), shown and heard; a night of sleep that loosens what was learned by 20 % in precision, values kept
    (Tononi & Cirelli's synaptic homeostasis).
  • Its own units. Inside, it counts with c = ħ = G = k_B = 1 (pygrm.units "ticks"); every node with a dimension,
    positive or signed, is given and read in SI.
  • Nodes held as the brain seems to hold quantities: magnitudes in log with relative uncertainties (Weber), the
    inverse as the same node, and for a human every output as two opposed channels (ON and OFF), seen around zero and
    heard as two voices.
  • A base to hold on to (vm/base.grm): 30 points of the world from the Planck scales to the Sun, measured, with
    their dimensions, and three relations (surface gravity, the speed of sound, Kepler's third law).
  • A body. Keyboard and files in; for a human, a window with a part reserved to the outputs (value, bar, last 240
    ticks) and the surprise, and a voice per output (its pitch where its value stands, its loudness how much it has
    just moved; silent when the network holds still).
python vm/grm_vm.py            # terminal
python vm/grm_vm.py --window   # window, outputs shown and heard

grm talk (talk/)

Talk to a network from a terminal (node, relate, observe, ask, why, what-if), watch it work in a live
graph, and time it on two modelled machines: a classic CPU with a RAM (dense QR, as pygrm) against the relational
machine. On the equation/ store network: 515 processors, 134 rounds; the number of rounds stays about 80 from 100
to 10 000 random nodes. A model, not a chip: in Python the simulation is slower than pygrm.
talk/universe.grm: the SI constants, the cosmos and the seven relations of the chain; S · E_quant = E_stock comes
out of them.

Limits

  • Uncertainties given by the messages are not reliable on networks with loops (values are). A relation that sees its
    answers swing calms itself down (a loop of exact relations saying the same thing twice made them blow up).
  • A fusion is not undone yet; data from a file is taken as exact.
  • What it finds by itself: the forms above, between up to three inputs; with many inputs it will have to look first
    near what moves together.
  • Python: the relational machine is simulated one processor after the other.

Requirements

pygrm 0.3.0 (for the machine's units and for what it finds by itself; the rest runs without it), numpy,
matplotlib (the live graph), tkinter (the window; it comes with Python on Windows).