Loading an existing multiverse

An existing multiverse can be loaded in two different ways:

  1. As creating a multiverse (without running it) is cheap, one can simply run the same script/functions again, and comment out the .run() method.

  2. The multiverse can also be loaded from disk by simply providing its folder as a relative path (e.g. its name) or its absolute path (useful if it is loaded from a different file)

Approach 1:

[1]:
from comet.multiverse import Multiverse

forking_paths = {
    "strings": ["Hello", "world"],
    "numbers": [3.14, 4]
}

def analysis_template():
    pass

mverse = Multiverse(name="example_mv_load")
mverse.create(analysis_template, forking_paths)
mverse.summary()
#mverse.run()
Universe Decision 1 Value 1 Decision 2 Value 2
0 Universe_1 strings Hello numbers 3.14
1 Universe_2 strings Hello numbers 4.00
2 Universe_3 strings world numbers 3.14
3 Universe_4 strings world numbers 4.00

Approach 2:

[2]:
from comet import multiverse

mverse = multiverse.load_multiverse("example_mv_load")
mverse.summary()
Universe Decision 1 Value 1 Decision 2 Value 2
0 Universe_1 strings Hello numbers 3.14
1 Universe_2 strings Hello numbers 4.00
2 Universe_3 strings world numbers 3.14
3 Universe_4 strings world numbers 4.00

Note: If the previously created multiverse contains results, these can be visualized/analyzed after loading. However, if the multiverse specification was changed (e.g. by modifying the forking paths in the first approach), the previous results will only be removed/updated once .run() is called again.