Liking cljdoc? Tell your friends :D

org.replikativ.foerster.random

Where inference draws its randomness from.

Every draw of a seeded inference run must depend only on WHAT is drawn, not on when: particles, chains and proposals run concurrently, and one generator shared in arrival order makes a seeded run reproducible only on a serial executor. So a draw made while deciding something in a world — a sample site, the site an MH move selects, its acceptance — reads a STREAM keyed by that world's seed and what is being decided:

stream(world, key) = generator seeded by hash(seed(world), key)

World seeds are derived per fork from the parent's seed, the site address and the fork index (savepoint/fork), so a replay's fresh proposal draws from a fresh stream and the same run draws the same numbers. Draws outside any world — the seeds of an inference's sessions, SMC's resampling at a barrier — come from the process generator in program order, which set-seed! seeds.

The generator is xoshiro128** on 32-bit words, so a seed gives the same numbers on the JVM and in JavaScript.

Where inference draws its randomness from.

Every draw of a seeded inference run must depend only on WHAT is drawn,
not on when: particles, chains and proposals run concurrently, and one
generator shared in arrival order makes a seeded run reproducible only on
a serial executor. So a draw made while deciding something in a world —
a sample site, the site an MH move selects, its acceptance — reads a
STREAM keyed by that world's seed and what is being decided:

  stream(world, key) = generator seeded by hash(seed(world), key)

World seeds are derived per fork from the parent's seed, the site address
and the fork index (`savepoint/fork`), so a replay's fresh proposal draws
from a fresh stream and the same run draws the same numbers. Draws outside
any world — the seeds of an inference's sessions, SMC's resampling at a
barrier — come from the process generator in program order, which
`set-seed!` seeds.

The generator is xoshiro128** on 32-bit words, so a seed gives the same
numbers on the JVM and in JavaScript.
raw docstring

*stream*clj/s

The stream draws come from, or nil for the process generator.

The stream draws come from, or nil for the process generator.
sourceraw docstring

currentclj/s

(current)

The generator draws come from now.

The generator draws come from now.
sourceraw docstring

fresh-seedclj/s

(fresh-seed)

A seed for a new session, drawn from the current generator: in a seeded run, the same seeds in the same program order.

A seed for a new session, drawn from the current generator: in a seeded
run, the same seeds in the same program order.
sourceraw docstring

generatorclj/s

(generator seed)

A generator seeded by seed (any value).

A generator seeded by `seed` (any value).
sourceraw docstring

in-world-streamclj/s

(in-world-stream world key f)

Call f drawing from world's stream for key.

Call `f` drawing from `world`'s stream for `key`.
sourceraw docstring

next-double!clj/s

(next-double! g)

The next double in [0, 1) of g: 53 random bits.

The next double in [0, 1) of `g`: 53 random bits.
sourceraw docstring

next-u32!clj/s

(next-u32! g)

The next unsigned 32-bit word of g.

The next unsigned 32-bit word of `g`.
sourceraw docstring

set-seed!clj/s

(set-seed! seed)

Seed the process generator: the draws made outside any world stream.

Seed the process generator: the draws made outside any world stream.
sourceraw docstring

uniform01clj/s

(uniform01)

A uniform draw in [0, 1) from the current generator.

A uniform draw in [0, 1) from the current generator.
sourceraw docstring

with-stream*clj/s

(with-stream* seed key f)

Call f with draws coming from the stream keyed by seed and key. A nil seed (no session) leaves draws on the process generator.

Call `f` with draws coming from the stream keyed by `seed` and `key`. A nil
seed (no session) leaves draws on the process generator.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close