{ "cells": [ { "cell_type": "markdown", "id": "703c18a3", "metadata": {}, "source": [ "# Loading an existing multiverse\n", "\n", "An existing multiverse can be loaded in two different ways:\n", "\n", "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.\n", "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)\n", "\n", "Approach 1:" ] }, { "cell_type": "code", "execution_count": 1, "id": "5892663c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
UniverseDecision 1Value 1Decision 2Value 2
0Universe_1stringsHellonumbers3.14
1Universe_2stringsHellonumbers4.00
2Universe_3stringsworldnumbers3.14
3Universe_4stringsworldnumbers4.00
\n", "
" ], "text/plain": [ " Universe Decision 1 Value 1 Decision 2 Value 2\n", "0 Universe_1 strings Hello numbers 3.14\n", "1 Universe_2 strings Hello numbers 4.00\n", "2 Universe_3 strings world numbers 3.14\n", "3 Universe_4 strings world numbers 4.00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from comet.multiverse import Multiverse\n", "\n", "forking_paths = {\n", " \"strings\": [\"Hello\", \"world\"],\n", " \"numbers\": [3.14, 4]\n", "}\n", "\n", "def analysis_template():\n", " pass\n", "\n", "mverse = Multiverse(name=\"example_mv_load\")\n", "mverse.create(analysis_template, forking_paths)\n", "mverse.summary()\n", "#mverse.run()" ] }, { "cell_type": "markdown", "id": "7389ab0a", "metadata": {}, "source": [ "Approach 2:" ] }, { "cell_type": "code", "execution_count": 2, "id": "ccb1684e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
UniverseDecision 1Value 1Decision 2Value 2
0Universe_1stringsHellonumbers3.14
1Universe_2stringsHellonumbers4.00
2Universe_3stringsworldnumbers3.14
3Universe_4stringsworldnumbers4.00
\n", "
" ], "text/plain": [ " Universe Decision 1 Value 1 Decision 2 Value 2\n", "0 Universe_1 strings Hello numbers 3.14\n", "1 Universe_2 strings Hello numbers 4.00\n", "2 Universe_3 strings world numbers 3.14\n", "3 Universe_4 strings world numbers 4.00" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from comet import multiverse\n", "\n", "mverse = multiverse.load_multiverse(\"example_mv_load\")\n", "mverse.summary()" ] }, { "cell_type": "markdown", "id": "94d39321", "metadata": {}, "source": [ "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." ] } ], "metadata": { "kernelspec": { "display_name": "comet", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" } }, "nbformat": 4, "nbformat_minor": 5 }