{ "cells": [ { "cell_type": "markdown", "id": "52f72cbb-f373-4c4a-89b0-e73a3cdba306", "metadata": { "tags": [] }, "source": [ "# Experiments Table\n", "\n", "The experiments table is used to visualize all the experiments logged to a given project,\n", "as well as the metadata, parameters, and metrics logged to each of those experiments. Users\n", "can filter and sort the data in the table to easily explore and interpret results logged to\n", "the experiments.\n", "\n", "When present in a `rubicon_ml.viz.Dashboard`, an experiments table acts a controller to select\n", "the experiments visible in the other widgets in the dashboard.\n", "\n", "The table itself is a Dash `data_table`. More information can be found in [the Dash documentation](https://dash.plotly.com/datatable)." ] }, { "cell_type": "code", "execution_count": 1, "id": "39fc471a-c80b-491b-9802-3e6db4f09546", "metadata": {}, "outputs": [], "source": [ "import random\n", "\n", "from rubicon_ml import Rubicon\n", "from rubicon_ml.viz import ExperimentsTable" ] }, { "cell_type": "markdown", "id": "e02d504d-805d-4d17-a368-1bcbe1586e82", "metadata": {}, "source": [ "First, we'll create a few experiments and log some parameters and a metric to them." ] }, { "cell_type": "code", "execution_count": 2, "id": "367350e6-7071-433e-86e9-fd03e72a5151", "metadata": {}, "outputs": [], "source": [ "rubicon = Rubicon(persistence=\"memory\", auto_git_enabled=True)\n", "project = rubicon.get_or_create_project(\"experiment table\")\n", "\n", "for i in range(0, 24):\n", " experiment = project.log_experiment()\n", " experiment.log_parameter(name=\"max_depth\", tags=[\"show me\"], value=random.randrange(5, 25, 5))\n", " experiment.log_parameter(name=\"n_estimators\", tags=[\"show me\"], value=random.randrange(2, 12, 2))\n", " experiment.log_parameter(name=\"extra_parameter\", value=random.randrange(0, 2))\n", " experiment.log_metric(name=\"accuracy\", tags=[\"show me\"], value=random.random())\n", " experiment.log_metric(name=\"extra_metric\", value=random.random())" ] }, { "cell_type": "markdown", "id": "061b291c-fc8d-434d-8ad7-3539b463f788", "metadata": {}, "source": [ "Now, we can instantiate the `ExperimentsTable` object with the experiments we just\n", "logged and view the table right in this notebook with `show`. The Dash application\n", "itself will be running on http://127.0.0.1:8050/ when running locally. Use the\n", "`serve` command to launch the server directly without rendering the widget in the\n", "current Python interpreter.\n", "\n", "**Note:** The parameters and metrics shown when the `ExperimentsTable` first renders\n", "can be controlled by the class' other input arguments. The configuration below will\n", "only show the metrics and parameters tagged with \"show me\" when the table first renders." ] }, { "cell_type": "code", "execution_count": 3, "id": "8cb7d191-2b60-4984-80ba-dbb2b310c4bf", "metadata": {}, "outputs": [], "source": [ "ExperimentsTable(\n", " experiments=project.experiments(),\n", " parameter_query_tags=[\"show me\"],\n", " metric_query_tags=[\"show me\"],\n", ").show()" ] }, { "cell_type": "markdown", "id": "7487389b-c6b2-4dc5-ac05-3b5bc68f957d", "metadata": {}, "source": [ "![experiments-table](experiments-table.png \"experiments table\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.14" } }, "nbformat": 4, "nbformat_minor": 5 }