dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
21 stars 16 forks source link

Reproducibility - Fix random seed on bsb #759

Open drodarie opened 10 months ago

drodarie commented 10 months ago

In order to be able to guarantee reproducibility of reconstruction and/or specific bug, as a user, I would like to be able to set a random seed to bsb. All reconstruction steps are concerned.

Helveg commented 8 months ago

This will require a technical proposal to address RNG in the framework.

I propose:

We can create multiple subtypes of RandomGeneratorNodes like NumpyRandomGeneratorNode and NestRandomGeneratorNode that can initialize and pin down random number generation for these libraries we use, and provide a default scaffold one that users can use with self.scaffold.random and can configure from the rng node:

rng:
  scaffold:
    type: numpy
    generator: PCG64
    seed: 15
  nest:
    type: nest
    generator: Philox_64
    seed: 100

This would make self.scaffold.random a numpy PCG64 generator with seed 15, and would set nest.rng_type = 'Philox_64' and nest.rng_seed = 100. We should follow numpy's Generator interface. In the case that we're only setting RNG stuff for a dependency that type of node can just raise NotImplementedErrors