{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "db54cdf9",
   "metadata": {},
   "source": [
    "# Running Tune experiments with BayesOpt\n",
    "\n",
    "In this tutorial we introduce BayesOpt, while running a simple Ray Tune experiment. Tune’s Search Algorithms integrate with BayesOpt and, as a result, allow you to seamlessly scale up a BayesOpt optimization process - without sacrificing performance.\n",
    "\n",
    "BayesOpt is a constrained global optimization package utilizing Bayesian inference on gaussian processes, where the emphasis is on finding the maximum value of an unknown function in as few iterations as possible. BayesOpt's techniques are particularly suited for optimization of high cost functions, situations where the balance between exploration and exploitation is important. Therefore BayesOpt falls in the domain of \"derivative-free\" and \"black-box\" optimization. In this example we minimize a simple objective to briefly demonstrate the usage of BayesOpt with Ray Tune via `BayesOptSearch`, including conditional search spaces. It's useful to keep in mind that despite the emphasis on machine learning experiments, Ray Tune optimizes any implicit or explicit objective. Here we assume `bayesian-optimization==1.2.0` library is installed. To learn more, please refer to [BayesOpt website](https://github.com/fmfn/BayesianOptimization)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7ed16354",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: bayesian-optimization==1.2.0 in /Users/kai/.pyenv/versions/3.7.7/lib/python3.7/site-packages (1.2.0)\n",
      "Requirement already satisfied: scikit-learn>=0.18.0 in /Users/kai/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from bayesian-optimization==1.2.0) (0.24.2)\n",
      "Requirement already satisfied: numpy>=1.9.0 in /Users/kai/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from bayesian-optimization==1.2.0) (1.21.6)\n",
      "Requirement already satisfied: scipy>=0.14.0 in /Users/kai/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from bayesian-optimization==1.2.0) (1.4.1)\n",
      "Requirement already satisfied: joblib>=0.11 in /Users/kai/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from scikit-learn>=0.18.0->bayesian-optimization==1.2.0) (1.1.0)\n",
      "Requirement already satisfied: threadpoolctl>=2.0.0 in /Users/kai/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from scikit-learn>=0.18.0->bayesian-optimization==1.2.0) (3.0.0)\n",
      "\u001b[33mWARNING: There was an error checking the latest version of pip.\u001b[0m\u001b[33m\n",
      "\u001b[0m"
     ]
    }
   ],
   "source": [
    "# !pip install ray[tune]\n",
    "!pip install bayesian-optimization==1.2.0"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2236f834",
   "metadata": {},
   "source": [
    "Click below to see all the imports we need for this example.\n",
    "You can also launch directly into a Binder instance to run this notebook yourself.\n",
    "Just click on the rocket symbol at the top of the navigation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6d36c78b",
   "metadata": {
    "tags": [
     "hide-input"
    ]
   },
   "outputs": [],
   "source": [
    "import time\n",
    "\n",
    "import ray\n",
    "from ray import tune\n",
    "from ray.air import session\n",
    "from ray.tune.search import ConcurrencyLimiter\n",
    "from ray.tune.search.bayesopt import BayesOptSearch"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6257a3a8",
   "metadata": {},
   "source": [
    "Let's start by defining a simple evaluation function.\n",
    "We artificially sleep for a bit (`0.1` seconds) to simulate a long-running ML experiment.\n",
    "This setup assumes that we're running multiple `step`s of an experiment and try to tune two hyperparameters,\n",
    "namely `width` and `height`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "646c75a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "def evaluate(step, width, height):\n",
    "    time.sleep(0.1)\n",
    "    return (0.1 + width * step / 100) ** (-1) + height * 0.1"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d89b7fdc",
   "metadata": {},
   "source": [
    "Next, our ``objective`` function takes a Tune ``config``, evaluates the `score` of your experiment in a training loop,\n",
    "and uses `session.report` to report the `score` back to Tune."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e9adf637",
   "metadata": {},
   "outputs": [],
   "source": [
    "def objective(config):\n",
    "    for step in range(config[\"steps\"]):\n",
    "        score = evaluate(step, config[\"width\"], config[\"height\"])\n",
    "        session.report({\"iterations\": step, \"mean_loss\": score})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "bc634b1d",
   "metadata": {
    "lines_to_next_cell": 0,
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "    <div style=\"margin-left: 50px;display: flex;flex-direction: row;align-items: center\">\n",
       "        <h3 style=\"color: var(--jp-ui-font-color0)\">Ray</h3>\n",
       "        <svg version=\"1.1\" id=\"ray\" width=\"3em\" viewBox=\"0 0 144.5 144.6\" style=\"margin-left: 3em;margin-right: 3em\">\n",
       "            <g id=\"layer-1\">\n",
       "                <path fill=\"#00a2e9\" class=\"st0\" d=\"M97.3,77.2c-3.8-1.1-6.2,0.9-8.3,5.1c-3.5,6.8-9.9,9.9-17.4,9.6S58,88.1,54.8,81.2c-1.4-3-3-4-6.3-4.1\n",
       "                    c-5.6-0.1-9.9,0.1-13.1,6.4c-3.8,7.6-13.6,10.2-21.8,7.6C5.2,88.4-0.4,80.5,0,71.7c0.1-8.4,5.7-15.8,13.8-18.2\n",
       "                    c8.4-2.6,17.5,0.7,22.3,8c1.3,1.9,1.3,5.2,3.6,5.6c3.9,0.6,8,0.2,12,0.2c1.8,0,1.9-1.6,2.4-2.8c3.5-7.8,9.7-11.8,18-11.9\n",
       "                    c8.2-0.1,14.4,3.9,17.8,11.4c1.3,2.8,2.9,3.6,5.7,3.3c1-0.1,2,0.1,3,0c2.8-0.5,6.4,1.7,8.1-2.7s-2.3-5.5-4.1-7.5\n",
       "                    c-5.1-5.7-10.9-10.8-16.1-16.3C84,38,81.9,37.1,78,38.3C66.7,42,56.2,35.7,53,24.1C50.3,14,57.3,2.8,67.7,0.5\n",
       "                    C78.4-2,89,4.7,91.5,15.3c0.1,0.3,0.1,0.5,0.2,0.8c0.7,3.4,0.7,6.9-0.8,9.8c-1.7,3.2-0.8,5,1.5,7.2c6.7,6.5,13.3,13,19.8,19.7\n",
       "                    c1.8,1.8,3,2.1,5.5,1.2c9.1-3.4,17.9-0.6,23.4,7c4.8,6.9,4.6,16.1-0.4,22.9c-5.4,7.2-14.2,9.9-23.1,6.5c-2.3-0.9-3.5-0.6-5.1,1.1\n",
       "                    c-6.7,6.9-13.6,13.7-20.5,20.4c-1.8,1.8-2.5,3.2-1.4,5.9c3.5,8.7,0.3,18.6-7.7,23.6c-7.9,5-18.2,3.8-24.8-2.9\n",
       "                    c-6.4-6.4-7.4-16.2-2.5-24.3c4.9-7.8,14.5-11,23.1-7.8c3,1.1,4.7,0.5,6.9-1.7C91.7,98.4,98,92.3,104.2,86c1.6-1.6,4.1-2.7,2.6-6.2\n",
       "                    c-1.4-3.3-3.8-2.5-6.2-2.6C99.8,77.2,98.9,77.2,97.3,77.2z M72.1,29.7c5.5,0.1,9.9-4.3,10-9.8c0-0.1,0-0.2,0-0.3\n",
       "                    C81.8,14,77,9.8,71.5,10.2c-5,0.3-9,4.2-9.3,9.2c-0.2,5.5,4,10.1,9.5,10.3C71.8,29.7,72,29.7,72.1,29.7z M72.3,62.3\n",
       "                    c-5.4-0.1-9.9,4.2-10.1,9.7c0,0.2,0,0.3,0,0.5c0.2,5.4,4.5,9.7,9.9,10c5.1,0.1,9.9-4.7,10.1-9.8c0.2-5.5-4-10-9.5-10.3\n",
       "                    C72.6,62.3,72.4,62.3,72.3,62.3z M115,72.5c0.1,5.4,4.5,9.7,9.8,9.9c5.6-0.2,10-4.8,10-10.4c-0.2-5.4-4.6-9.7-10-9.7\n",
       "                    c-5.3-0.1-9.8,4.2-9.9,9.5C115,72.1,115,72.3,115,72.5z M19.5,62.3c-5.4,0.1-9.8,4.4-10,9.8c-0.1,5.1,5.2,10.4,10.2,10.3\n",
       "                    c5.6-0.2,10-4.9,9.8-10.5c-0.1-5.4-4.5-9.7-9.9-9.6C19.6,62.3,19.5,62.3,19.5,62.3z M71.8,134.6c5.9,0.2,10.3-3.9,10.4-9.6\n",
       "                    c0.5-5.5-3.6-10.4-9.1-10.8c-5.5-0.5-10.4,3.6-10.8,9.1c0,0.5,0,0.9,0,1.4c-0.2,5.3,4,9.8,9.3,10\n",
       "                    C71.6,134.6,71.7,134.6,71.8,134.6z\"/>\n",
       "            </g>\n",
       "        </svg>\n",
       "        <table>\n",
       "            <tr>\n",
       "                <td style=\"text-align: left\"><b>Python version:</b></td>\n",
       "                <td style=\"text-align: left\"><b>3.7.7</b></td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                <td style=\"text-align: left\"><b>Ray version:</b></td>\n",
       "                <td style=\"text-align: left\"><b> 3.0.0.dev0</b></td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "    <td style=\"text-align: left\"><b>Dashboard:</b></td>\n",
       "    <td style=\"text-align: left\"><b><a href=\"http://127.0.0.1:8266\" target=\"_blank\">http://127.0.0.1:8266</a></b></td>\n",
       "</tr>\n",
       "\n",
       "        </table>\n",
       "    </div>\n",
       "</div>\n"
      ],
      "text/plain": [
       "RayContext(dashboard_url='127.0.0.1:8266', python_version='3.7.7', ray_version='3.0.0.dev0', ray_commit='{{RAY_COMMIT_SHA}}', address_info={'node_ip_address': '127.0.0.1', 'raylet_ip_address': '127.0.0.1', 'redis_address': None, 'object_store_address': '/tmp/ray/session_2022-07-22_15-30-02_149801_46800/sockets/plasma_store', 'raylet_socket_name': '/tmp/ray/session_2022-07-22_15-30-02_149801_46800/sockets/raylet', 'webui_url': '127.0.0.1:8266', 'session_dir': '/tmp/ray/session_2022-07-22_15-30-02_149801_46800', 'metrics_export_port': 61358, 'gcs_address': '127.0.0.1:61452', 'address': '127.0.0.1:61452', 'dashboard_agent_listen_port': 52365, 'node_id': 'af68dd2eb5791913931005bd8d62a94b3507a476cef5cdb6cb08521a'})"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ray.init(configure_logging=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0b9a2c4d",
   "metadata": {},
   "source": [
    "Now we define the search algorithm built from `BayesOptSearch`, constrained  to a maximum of `4` concurrent trials with a `ConcurrencyLimiter`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "6f1d2fe7",
   "metadata": {},
   "outputs": [],
   "source": [
    "algo = BayesOptSearch(utility_kwargs={\"kind\": \"ucb\", \"kappa\": 2.5, \"xi\": 0.0})\n",
    "algo = ConcurrencyLimiter(algo, max_concurrent=4)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27963e39",
   "metadata": {},
   "source": [
    "The number of samples is the number of hyperparameter combinations that will be tried out. This Tune run is set to `1000` samples.\n",
    "(you can decrease this if it takes too long on your machine)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "d777201c",
   "metadata": {},
   "outputs": [],
   "source": [
    "num_samples = 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "bb5f39a6",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "# If 1000 samples take too long, you can reduce this number.\n",
    "# We override this number here for our smoke tests.\n",
    "num_samples = 10"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "752523c8",
   "metadata": {},
   "source": [
    "Next we define a search space. The critical assumption is that the optimal hyperparameters live within this space. Yet, if the space is very large, then those hyperparameters may be difficult to find in a short amount of time."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "116f8757",
   "metadata": {},
   "outputs": [],
   "source": [
    "search_space = {\n",
    "    \"steps\": 100,\n",
    "    \"width\": tune.uniform(0, 20),\n",
    "    \"height\": tune.uniform(-100, 100),\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1754bf85",
   "metadata": {},
   "source": [
    "Finally, we run the experiment to `\"min\"`imize the \"mean_loss\" of the `objective` by searching `search_config` via `algo`, `num_samples` times. This previous sentence is fully characterizes the search problem we aim to solve. With this in mind, notice how efficient it is to execute `tuner.fit()`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "5c44a0c5",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Function checkpointing is disabled. This may result in unexpected behavior when using checkpointing features or certain schedulers. To enable, set the train function arguments to be `func(config, checkpoint_dir=None)`.\n",
      "BayesOpt does not support specific sampling methods. The Uniform sampler will be dropped.\n",
      "BayesOpt does not support specific sampling methods. The Uniform sampler will be dropped.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "== Status ==<br>Current time: 2022-07-22 15:30:53 (running for 00:00:43.91)<br>Memory usage on this node: 10.4/16.0 GiB<br>Using FIFO scheduling algorithm.<br>Resources requested: 0/16 CPUs, 0/0 GPUs, 0.0/4.47 GiB heap, 0.0/2.0 GiB objects<br>Current best trial: d42ac71c with mean_loss=-9.536507956046009 and parameters={'steps': 100, 'width': 19.398197043239886, 'height': -95.88310114083951}<br>Result logdir: /Users/kai/ray_results/objective_2022-07-22_15-30-08<br>Number of trials: 10/10 (10 TERMINATED)<br><table>\n",
       "<thead>\n",
       "<tr><th>Trial name        </th><th>status    </th><th>loc            </th><th style=\"text-align: right;\">  height</th><th style=\"text-align: right;\">   width</th><th style=\"text-align: right;\">    loss</th><th style=\"text-align: right;\">  iter</th><th style=\"text-align: right;\">  total time (s)</th><th style=\"text-align: right;\">  iterations</th><th style=\"text-align: right;\">  neg_mean_loss</th></tr>\n",
       "</thead>\n",
       "<tbody>\n",
       "<tr><td>objective_c9daa5d4</td><td>TERMINATED</td><td>127.0.0.1:46960</td><td style=\"text-align: right;\">-25.092 </td><td style=\"text-align: right;\">19.0143 </td><td style=\"text-align: right;\">-2.45636</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.9865</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        2.45636</td></tr>\n",
       "<tr><td>objective_cb9bc830</td><td>TERMINATED</td><td>127.0.0.1:46968</td><td style=\"text-align: right;\"> 46.3988</td><td style=\"text-align: right;\">11.9732 </td><td style=\"text-align: right;\"> 4.72354</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         11.5661</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">       -4.72354</td></tr>\n",
       "<tr><td>objective_cb9d338c</td><td>TERMINATED</td><td>127.0.0.1:46969</td><td style=\"text-align: right;\">-68.7963</td><td style=\"text-align: right;\"> 3.11989</td><td style=\"text-align: right;\">-6.56602</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         11.648 </td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        6.56602</td></tr>\n",
       "<tr><td>objective_cb9e97e0</td><td>TERMINATED</td><td>127.0.0.1:46970</td><td style=\"text-align: right;\">-88.3833</td><td style=\"text-align: right;\">17.3235 </td><td style=\"text-align: right;\">-8.78036</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         11.6948</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        8.78036</td></tr>\n",
       "<tr><td>objective_d229961e</td><td>TERMINATED</td><td>127.0.0.1:47009</td><td style=\"text-align: right;\"> 20.223 </td><td style=\"text-align: right;\">14.1615 </td><td style=\"text-align: right;\"> 2.09312</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.8549</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">       -2.09312</td></tr>\n",
       "<tr><td>objective_d42ac71c</td><td>TERMINATED</td><td>127.0.0.1:47036</td><td style=\"text-align: right;\">-95.8831</td><td style=\"text-align: right;\">19.3982 </td><td style=\"text-align: right;\">-9.53651</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.7931</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        9.53651</td></tr>\n",
       "<tr><td>objective_d43ca61c</td><td>TERMINATED</td><td>127.0.0.1:47039</td><td style=\"text-align: right;\"> 66.4885</td><td style=\"text-align: right;\"> 4.24678</td><td style=\"text-align: right;\"> 6.88118</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.7606</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">       -6.88118</td></tr>\n",
       "<tr><td>objective_d43fb190</td><td>TERMINATED</td><td>127.0.0.1:47040</td><td style=\"text-align: right;\">-63.635 </td><td style=\"text-align: right;\"> 3.66809</td><td style=\"text-align: right;\">-6.09551</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.7997</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        6.09551</td></tr>\n",
       "<tr><td>objective_da1ff46c</td><td>TERMINATED</td><td>127.0.0.1:47057</td><td style=\"text-align: right;\">-39.1516</td><td style=\"text-align: right;\">10.4951 </td><td style=\"text-align: right;\">-3.81983</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.7762</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        3.81983</td></tr>\n",
       "<tr><td>objective_dc25c796</td><td>TERMINATED</td><td>127.0.0.1:47062</td><td style=\"text-align: right;\">-13.611 </td><td style=\"text-align: right;\"> 5.82458</td><td style=\"text-align: right;\">-1.19064</td><td style=\"text-align: right;\">   100</td><td style=\"text-align: right;\">         10.7213</td><td style=\"text-align: right;\">          99</td><td style=\"text-align: right;\">        1.19064</td></tr>\n",
       "</tbody>\n",
       "</table><br><br>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Result for objective_c9daa5d4:\n",
      "  date: 2022-07-22_15-30-12\n",
      "  done: false\n",
      "  experiment_id: 422a6d2a512a470480e33913d7825a7a\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 7.490802376947249\n",
      "  neg_mean_loss: -7.490802376947249\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46960\n",
      "  time_since_restore: 0.1042318344116211\n",
      "  time_this_iter_s: 0.1042318344116211\n",
      "  time_total_s: 0.1042318344116211\n",
      "  timestamp: 1658500212\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: c9daa5d4\n",
      "  warmup_time: 0.0032601356506347656\n",
      "  \n",
      "Result for objective_cb9bc830:\n",
      "  date: 2022-07-22_15-30-15\n",
      "  done: false\n",
      "  experiment_id: 3a9a6bef89ec4b57bd0fa24dd3b407e6\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 14.639878836228101\n",
      "  neg_mean_loss: -14.639878836228101\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46968\n",
      "  time_since_restore: 0.10442280769348145\n",
      "  time_this_iter_s: 0.10442280769348145\n",
      "  time_total_s: 0.10442280769348145\n",
      "  timestamp: 1658500215\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: cb9bc830\n",
      "  warmup_time: 0.0038840770721435547\n",
      "  \n",
      "Result for objective_cb9e97e0:\n",
      "  date: 2022-07-22_15-30-15\n",
      "  done: false\n",
      "  experiment_id: b0266e323ced4991b155344b34c25c59\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 1.1616722433639897\n",
      "  neg_mean_loss: -1.1616722433639897\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46970\n",
      "  time_since_restore: 0.10328483581542969\n",
      "  time_this_iter_s: 0.10328483581542969\n",
      "  time_total_s: 0.10328483581542969\n",
      "  timestamp: 1658500215\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: cb9e97e0\n",
      "  warmup_time: 0.004090070724487305\n",
      "  \n",
      "Result for objective_cb9d338c:\n",
      "  date: 2022-07-22_15-30-15\n",
      "  done: false\n",
      "  experiment_id: 2731a83e40eb468fb79e19f872b8f597\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 3.120372808848731\n",
      "  neg_mean_loss: -3.120372808848731\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46969\n",
      "  time_since_restore: 0.1042470932006836\n",
      "  time_this_iter_s: 0.1042470932006836\n",
      "  time_total_s: 0.1042470932006836\n",
      "  timestamp: 1658500215\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: cb9d338c\n",
      "  warmup_time: 0.003387928009033203\n",
      "  \n",
      "Result for objective_c9daa5d4:\n",
      "  date: 2022-07-22_15-30-17\n",
      "  done: false\n",
      "  experiment_id: 422a6d2a512a470480e33913d7825a7a\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 45\n",
      "  iterations_since_restore: 46\n",
      "  mean_loss: -2.393676542940848\n",
      "  neg_mean_loss: 2.393676542940848\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46960\n",
      "  time_since_restore: 5.1730430126190186\n",
      "  time_this_iter_s: 0.10674905776977539\n",
      "  time_total_s: 5.1730430126190186\n",
      "  timestamp: 1658500217\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 46\n",
      "  trial_id: c9daa5d4\n",
      "  warmup_time: 0.0032601356506347656\n",
      "  \n",
      "Result for objective_cb9bc830:\n",
      "  date: 2022-07-22_15-30-20\n",
      "  done: false\n",
      "  experiment_id: 3a9a6bef89ec4b57bd0fa24dd3b407e6\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: 4.8144784432736065\n",
      "  neg_mean_loss: -4.8144784432736065\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46968\n",
      "  time_since_restore: 5.1083409786224365\n",
      "  time_this_iter_s: 0.10834097862243652\n",
      "  time_total_s: 5.1083409786224365\n",
      "  timestamp: 1658500220\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: cb9bc830\n",
      "  warmup_time: 0.0038840770721435547\n",
      "  \n",
      "Result for objective_cb9e97e0:\n",
      "  date: 2022-07-22_15-30-20\n",
      "  done: false\n",
      "  experiment_id: b0266e323ced4991b155344b34c25c59\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: -8.716998803293404\n",
      "  neg_mean_loss: 8.716998803293404\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46970\n",
      "  time_since_restore: 5.117117881774902\n",
      "  time_this_iter_s: 0.10473918914794922\n",
      "  time_total_s: 5.117117881774902\n",
      "  timestamp: 1658500220\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: cb9e97e0\n",
      "  warmup_time: 0.004090070724487305\n",
      "  \n",
      "Result for objective_cb9d338c:\n",
      "  date: 2022-07-22_15-30-20\n",
      "  done: false\n",
      "  experiment_id: 2731a83e40eb468fb79e19f872b8f597\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: -6.241199660085543\n",
      "  neg_mean_loss: 6.241199660085543\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46969\n",
      "  time_since_restore: 5.1075780391693115\n",
      "  time_this_iter_s: 0.1051321029663086\n",
      "  time_total_s: 5.1075780391693115\n",
      "  timestamp: 1658500220\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: cb9d338c\n",
      "  warmup_time: 0.003387928009033203\n",
      "  \n",
      "Result for objective_c9daa5d4:\n",
      "  date: 2022-07-22_15-30-22\n",
      "  done: false\n",
      "  experiment_id: 422a6d2a512a470480e33913d7825a7a\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 92\n",
      "  iterations_since_restore: 93\n",
      "  mean_loss: -2.452357296882761\n",
      "  neg_mean_loss: 2.452357296882761\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46960\n",
      "  time_since_restore: 10.23116397857666\n",
      "  time_this_iter_s: 0.10653018951416016\n",
      "  time_total_s: 10.23116397857666\n",
      "  timestamp: 1658500222\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 93\n",
      "  trial_id: c9daa5d4\n",
      "  warmup_time: 0.0032601356506347656\n",
      "  \n",
      "Result for objective_c9daa5d4:\n",
      "  date: 2022-07-22_15-30-23\n",
      "  done: true\n",
      "  experiment_id: 422a6d2a512a470480e33913d7825a7a\n",
      "  experiment_tag: 1_height=-25.0920,steps=100,width=19.0143\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -2.456355072354658\n",
      "  neg_mean_loss: 2.456355072354658\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46960\n",
      "  time_since_restore: 10.986503839492798\n",
      "  time_this_iter_s: 0.10757803916931152\n",
      "  time_total_s: 10.986503839492798\n",
      "  timestamp: 1658500223\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: c9daa5d4\n",
      "  warmup_time: 0.0032601356506347656\n",
      "  \n",
      "Result for objective_cb9bc830:\n",
      "  date: 2022-07-22_15-30-24\n",
      "  done: false\n",
      "  experiment_id: 3a9a6bef89ec4b57bd0fa24dd3b407e6\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 91\n",
      "  iterations_since_restore: 92\n",
      "  mean_loss: 4.73082443425139\n",
      "  neg_mean_loss: -4.73082443425139\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46968\n",
      "  time_since_restore: 9.829612970352173\n",
      "  time_this_iter_s: 0.10725593566894531\n",
      "  time_total_s: 9.829612970352173\n",
      "  timestamp: 1658500224\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 92\n",
      "  trial_id: cb9bc830\n",
      "  warmup_time: 0.0038840770721435547\n",
      "  \n",
      "Result for objective_cb9e97e0:\n",
      "  date: 2022-07-22_15-30-24\n",
      "  done: false\n",
      "  experiment_id: b0266e323ced4991b155344b34c25c59\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 90\n",
      "  iterations_since_restore: 91\n",
      "  mean_loss: -8.774597648541096\n",
      "  neg_mean_loss: 8.774597648541096\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46970\n",
      "  time_since_restore: 9.72621202468872\n",
      "  time_this_iter_s: 0.10692906379699707\n",
      "  time_total_s: 9.72621202468872\n",
      "  timestamp: 1658500224\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 91\n",
      "  trial_id: cb9e97e0\n",
      "  warmup_time: 0.004090070724487305\n",
      "  \n",
      "Result for objective_cb9d338c:\n",
      "  date: 2022-07-22_15-30-24\n",
      "  done: false\n",
      "  experiment_id: 2731a83e40eb468fb79e19f872b8f597\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 90\n",
      "  iterations_since_restore: 91\n",
      "  mean_loss: -6.535736572413468\n",
      "  neg_mean_loss: 6.535736572413468\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46969\n",
      "  time_since_restore: 9.71235203742981\n",
      "  time_this_iter_s: 0.10665416717529297\n",
      "  time_total_s: 9.71235203742981\n",
      "  timestamp: 1658500224\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 91\n",
      "  trial_id: cb9d338c\n",
      "  warmup_time: 0.003387928009033203\n",
      "  \n",
      "Result for objective_d229961e:\n",
      "  date: 2022-07-22_15-30-25\n",
      "  done: false\n",
      "  experiment_id: d8bb04569c644d6fabad5064c1828ba3\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 12.022300234864176\n",
      "  neg_mean_loss: -12.022300234864176\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47009\n",
      "  time_since_restore: 0.1041719913482666\n",
      "  time_this_iter_s: 0.1041719913482666\n",
      "  time_total_s: 0.1041719913482666\n",
      "  timestamp: 1658500225\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: d229961e\n",
      "  warmup_time: 0.003198862075805664\n",
      "  \n",
      "Result for objective_cb9bc830:\n",
      "  date: 2022-07-22_15-30-26\n",
      "  done: true\n",
      "  experiment_id: 3a9a6bef89ec4b57bd0fa24dd3b407e6\n",
      "  experiment_tag: 2_height=46.3988,steps=100,width=11.9732\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: 4.723536776402224\n",
      "  neg_mean_loss: -4.723536776402224\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46968\n",
      "  time_since_restore: 11.566141843795776\n",
      "  time_this_iter_s: 0.10738396644592285\n",
      "  time_total_s: 11.566141843795776\n",
      "  timestamp: 1658500226\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: cb9bc830\n",
      "  warmup_time: 0.0038840770721435547\n",
      "  \n",
      "Result for objective_cb9d338c:\n",
      "  date: 2022-07-22_15-30-26\n",
      "  done: true\n",
      "  experiment_id: 2731a83e40eb468fb79e19f872b8f597\n",
      "  experiment_tag: 3_height=-68.7963,steps=100,width=3.1199\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -6.566018929214734\n",
      "  neg_mean_loss: 6.566018929214734\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46969\n",
      "  time_since_restore: 11.647998809814453\n",
      "  time_this_iter_s: 0.1123647689819336\n",
      "  time_total_s: 11.647998809814453\n",
      "  timestamp: 1658500226\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: cb9d338c\n",
      "  warmup_time: 0.003387928009033203\n",
      "  \n",
      "Result for objective_cb9e97e0:\n",
      "  date: 2022-07-22_15-30-26\n",
      "  done: true\n",
      "  experiment_id: b0266e323ced4991b155344b34c25c59\n",
      "  experiment_tag: 4_height=-88.3833,steps=100,width=17.3235\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -8.780357708936942\n",
      "  neg_mean_loss: 8.780357708936942\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 46970\n",
      "  time_since_restore: 11.694752931594849\n",
      "  time_this_iter_s: 0.12678027153015137\n",
      "  time_total_s: 11.694752931594849\n",
      "  timestamp: 1658500226\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: cb9e97e0\n",
      "  warmup_time: 0.004090070724487305\n",
      "  \n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Result for objective_d42ac71c:\n",
      "  date: 2022-07-22_15-30-29\n",
      "  done: false\n",
      "  experiment_id: 3fdfaecb7adc4c5cb54c0aa76849d532\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 0.41168988591604894\n",
      "  neg_mean_loss: -0.41168988591604894\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47036\n",
      "  time_since_restore: 0.10324597358703613\n",
      "  time_this_iter_s: 0.10324597358703613\n",
      "  time_total_s: 0.10324597358703613\n",
      "  timestamp: 1658500229\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: d42ac71c\n",
      "  warmup_time: 0.0028409957885742188\n",
      "  \n",
      "Result for objective_d43ca61c:\n",
      "  date: 2022-07-22_15-30-29\n",
      "  done: false\n",
      "  experiment_id: 8f92f519ea5443be9efd6f4a8937b8ee\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 16.648852816008436\n",
      "  neg_mean_loss: -16.648852816008436\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47039\n",
      "  time_since_restore: 0.10412001609802246\n",
      "  time_this_iter_s: 0.10412001609802246\n",
      "  time_total_s: 0.10412001609802246\n",
      "  timestamp: 1658500229\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: d43ca61c\n",
      "  warmup_time: 0.002924203872680664\n",
      "  \n",
      "Result for objective_d43fb190:\n",
      "  date: 2022-07-22_15-30-29\n",
      "  done: false\n",
      "  experiment_id: 18283da742c74042ad3db1846fa7b460\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 3.6364993441420124\n",
      "  neg_mean_loss: -3.6364993441420124\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47040\n",
      "  time_since_restore: 0.10391902923583984\n",
      "  time_this_iter_s: 0.10391902923583984\n",
      "  time_total_s: 0.10391902923583984\n",
      "  timestamp: 1658500229\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: d43fb190\n",
      "  warmup_time: 0.0027680397033691406\n",
      "  \n",
      "Result for objective_d229961e:\n",
      "  date: 2022-07-22_15-30-30\n",
      "  done: false\n",
      "  experiment_id: d8bb04569c644d6fabad5064c1828ba3\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 46\n",
      "  iterations_since_restore: 47\n",
      "  mean_loss: 2.1734885512401174\n",
      "  neg_mean_loss: -2.1734885512401174\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47009\n",
      "  time_since_restore: 5.153247117996216\n",
      "  time_this_iter_s: 0.10638809204101562\n",
      "  time_total_s: 5.153247117996216\n",
      "  timestamp: 1658500230\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 47\n",
      "  trial_id: d229961e\n",
      "  warmup_time: 0.003198862075805664\n",
      "  \n",
      "Result for objective_d42ac71c:\n",
      "  date: 2022-07-22_15-30-34\n",
      "  done: false\n",
      "  experiment_id: 3fdfaecb7adc4c5cb54c0aa76849d532\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 46\n",
      "  iterations_since_restore: 47\n",
      "  mean_loss: -9.477484325687673\n",
      "  neg_mean_loss: 9.477484325687673\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47036\n",
      "  time_since_restore: 5.123893976211548\n",
      "  time_this_iter_s: 0.10898423194885254\n",
      "  time_total_s: 5.123893976211548\n",
      "  timestamp: 1658500234\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 47\n",
      "  trial_id: d42ac71c\n",
      "  warmup_time: 0.0028409957885742188\n",
      "  \n",
      "Result for objective_d43ca61c:\n",
      "  date: 2022-07-22_15-30-34\n",
      "  done: false\n",
      "  experiment_id: 8f92f519ea5443be9efd6f4a8937b8ee\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: 7.12595486600941\n",
      "  neg_mean_loss: -7.12595486600941\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47039\n",
      "  time_since_restore: 5.194939136505127\n",
      "  time_this_iter_s: 0.10889291763305664\n",
      "  time_total_s: 5.194939136505127\n",
      "  timestamp: 1658500234\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: d43ca61c\n",
      "  warmup_time: 0.002924203872680664\n",
      "  \n",
      "Result for objective_d43fb190:\n",
      "  date: 2022-07-22_15-30-34\n",
      "  done: false\n",
      "  experiment_id: 18283da742c74042ad3db1846fa7b460\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: -5.815255760980219\n",
      "  neg_mean_loss: 5.815255760980219\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47040\n",
      "  time_since_restore: 5.2366979122161865\n",
      "  time_this_iter_s: 0.10901784896850586\n",
      "  time_total_s: 5.2366979122161865\n",
      "  timestamp: 1658500234\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: d43fb190\n",
      "  warmup_time: 0.0027680397033691406\n",
      "  \n",
      "Result for objective_d229961e:\n",
      "  date: 2022-07-22_15-30-35\n",
      "  done: false\n",
      "  experiment_id: d8bb04569c644d6fabad5064c1828ba3\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 93\n",
      "  iterations_since_restore: 94\n",
      "  mean_loss: 2.097657333615391\n",
      "  neg_mean_loss: -2.097657333615391\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47009\n",
      "  time_since_restore: 10.209784984588623\n",
      "  time_this_iter_s: 0.10757803916931152\n",
      "  time_total_s: 10.209784984588623\n",
      "  timestamp: 1658500235\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 94\n",
      "  trial_id: d229961e\n",
      "  warmup_time: 0.003198862075805664\n",
      "  \n",
      "Result for objective_d229961e:\n",
      "  date: 2022-07-22_15-30-36\n",
      "  done: true\n",
      "  experiment_id: d8bb04569c644d6fabad5064c1828ba3\n",
      "  experiment_tag: 5_height=20.2230,steps=100,width=14.1615\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: 2.093122581973529\n",
      "  neg_mean_loss: -2.093122581973529\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47009\n",
      "  time_since_restore: 10.854872226715088\n",
      "  time_this_iter_s: 0.10703516006469727\n",
      "  time_total_s: 10.854872226715088\n",
      "  timestamp: 1658500236\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: d229961e\n",
      "  warmup_time: 0.003198862075805664\n",
      "  \n",
      "Result for objective_da1ff46c:\n",
      "  date: 2022-07-22_15-30-39\n",
      "  done: false\n",
      "  experiment_id: 9163132451a14ace8ddf394aeaae9018\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 6.0848448591907545\n",
      "  neg_mean_loss: -6.0848448591907545\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47057\n",
      "  time_since_restore: 0.10405993461608887\n",
      "  time_this_iter_s: 0.10405993461608887\n",
      "  time_total_s: 0.10405993461608887\n",
      "  timestamp: 1658500239\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: da1ff46c\n",
      "  warmup_time: 0.0030031204223632812\n",
      "  \n",
      "Result for objective_d42ac71c:\n",
      "  date: 2022-07-22_15-30-39\n",
      "  done: false\n",
      "  experiment_id: 3fdfaecb7adc4c5cb54c0aa76849d532\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 93\n",
      "  iterations_since_restore: 94\n",
      "  mean_loss: -9.533184304791206\n",
      "  neg_mean_loss: 9.533184304791206\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47036\n",
      "  time_since_restore: 10.145818948745728\n",
      "  time_this_iter_s: 0.10763311386108398\n",
      "  time_total_s: 10.145818948745728\n",
      "  timestamp: 1658500239\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 94\n",
      "  trial_id: d42ac71c\n",
      "  warmup_time: 0.0028409957885742188\n",
      "  \n",
      "Result for objective_d43ca61c:\n",
      "  date: 2022-07-22_15-30-39\n",
      "  done: false\n",
      "  experiment_id: 8f92f519ea5443be9efd6f4a8937b8ee\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 94\n",
      "  iterations_since_restore: 95\n",
      "  mean_loss: 6.893233568918634\n",
      "  neg_mean_loss: -6.893233568918634\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47039\n",
      "  time_since_restore: 10.217039108276367\n",
      "  time_this_iter_s: 0.10719418525695801\n",
      "  time_total_s: 10.217039108276367\n",
      "  timestamp: 1658500239\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 95\n",
      "  trial_id: d43ca61c\n",
      "  warmup_time: 0.002924203872680664\n",
      "  \n",
      "Result for objective_d43fb190:\n",
      "  date: 2022-07-22_15-30-39\n",
      "  done: false\n",
      "  experiment_id: 18283da742c74042ad3db1846fa7b460\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 94\n",
      "  iterations_since_restore: 95\n",
      "  mean_loss: -6.08165210701758\n",
      "  neg_mean_loss: 6.08165210701758\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47040\n",
      "  time_since_restore: 10.262099027633667\n",
      "  time_this_iter_s: 0.10874485969543457\n",
      "  time_total_s: 10.262099027633667\n",
      "  timestamp: 1658500239\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 95\n",
      "  trial_id: d43fb190\n",
      "  warmup_time: 0.0027680397033691406\n",
      "  \n",
      "Result for objective_d42ac71c:\n",
      "  date: 2022-07-22_15-30-39\n",
      "  done: true\n",
      "  experiment_id: 3fdfaecb7adc4c5cb54c0aa76849d532\n",
      "  experiment_tag: 6_height=-95.8831,steps=100,width=19.3982\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -9.536507956046009\n",
      "  neg_mean_loss: 9.536507956046009\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47036\n",
      "  time_since_restore: 10.793061017990112\n",
      "  time_this_iter_s: 0.10741710662841797\n",
      "  time_total_s: 10.793061017990112\n",
      "  timestamp: 1658500239\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: d42ac71c\n",
      "  warmup_time: 0.0028409957885742188\n",
      "  \n",
      "Result for objective_d43ca61c:\n",
      "  date: 2022-07-22_15-30-40\n",
      "  done: true\n",
      "  experiment_id: 8f92f519ea5443be9efd6f4a8937b8ee\n",
      "  experiment_tag: 7_height=66.4885,steps=100,width=4.2468\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: 6.881177852950684\n",
      "  neg_mean_loss: -6.881177852950684\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47039\n",
      "  time_since_restore: 10.760617017745972\n",
      "  time_this_iter_s: 0.10911297798156738\n",
      "  time_total_s: 10.760617017745972\n",
      "  timestamp: 1658500240\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: d43ca61c\n",
      "  warmup_time: 0.002924203872680664\n",
      "  \n",
      "Result for objective_d43fb190:\n",
      "  date: 2022-07-22_15-30-40\n",
      "  done: true\n",
      "  experiment_id: 18283da742c74042ad3db1846fa7b460\n",
      "  experiment_tag: 8_height=-63.6350,steps=100,width=3.6681\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -6.09550539698523\n",
      "  neg_mean_loss: 6.09550539698523\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47040\n",
      "  time_since_restore: 10.799743175506592\n",
      "  time_this_iter_s: 0.1067342758178711\n",
      "  time_total_s: 10.799743175506592\n",
      "  timestamp: 1658500240\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: d43fb190\n",
      "  warmup_time: 0.0027680397033691406\n",
      "  \n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Result for objective_dc25c796:\n",
      "  date: 2022-07-22_15-30-42\n",
      "  done: false\n",
      "  experiment_id: c0f302c32b284f8e99dbdfa90657ee7d\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 0\n",
      "  iterations_since_restore: 1\n",
      "  mean_loss: 8.638900372842315\n",
      "  neg_mean_loss: -8.638900372842315\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47062\n",
      "  time_since_restore: 0.10459494590759277\n",
      "  time_this_iter_s: 0.10459494590759277\n",
      "  time_total_s: 0.10459494590759277\n",
      "  timestamp: 1658500242\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 1\n",
      "  trial_id: dc25c796\n",
      "  warmup_time: 0.002794981002807617\n",
      "  \n",
      "Result for objective_da1ff46c:\n",
      "  date: 2022-07-22_15-30-44\n",
      "  done: false\n",
      "  experiment_id: 9163132451a14ace8ddf394aeaae9018\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: -3.7164550549457847\n",
      "  neg_mean_loss: 3.7164550549457847\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47057\n",
      "  time_since_restore: 5.180424928665161\n",
      "  time_this_iter_s: 0.10843396186828613\n",
      "  time_total_s: 5.180424928665161\n",
      "  timestamp: 1658500244\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: da1ff46c\n",
      "  warmup_time: 0.0030031204223632812\n",
      "  \n",
      "Result for objective_dc25c796:\n",
      "  date: 2022-07-22_15-30-47\n",
      "  done: false\n",
      "  experiment_id: c0f302c32b284f8e99dbdfa90657ee7d\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 47\n",
      "  iterations_since_restore: 48\n",
      "  mean_loss: -1.0086834162426133\n",
      "  neg_mean_loss: 1.0086834162426133\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47062\n",
      "  time_since_restore: 5.151978015899658\n",
      "  time_this_iter_s: 0.10736894607543945\n",
      "  time_total_s: 5.151978015899658\n",
      "  timestamp: 1658500247\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 48\n",
      "  trial_id: dc25c796\n",
      "  warmup_time: 0.002794981002807617\n",
      "  \n",
      "Result for objective_da1ff46c:\n",
      "  date: 2022-07-22_15-30-49\n",
      "  done: false\n",
      "  experiment_id: 9163132451a14ace8ddf394aeaae9018\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 94\n",
      "  iterations_since_restore: 95\n",
      "  mean_loss: -3.814808150093952\n",
      "  neg_mean_loss: 3.814808150093952\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47057\n",
      "  time_since_restore: 10.23661208152771\n",
      "  time_this_iter_s: 0.1076211929321289\n",
      "  time_total_s: 10.23661208152771\n",
      "  timestamp: 1658500249\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 95\n",
      "  trial_id: da1ff46c\n",
      "  warmup_time: 0.0030031204223632812\n",
      "  \n",
      "Result for objective_da1ff46c:\n",
      "  date: 2022-07-22_15-30-49\n",
      "  done: true\n",
      "  experiment_id: 9163132451a14ace8ddf394aeaae9018\n",
      "  experiment_tag: 9_height=-39.1516,steps=100,width=10.4951\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -3.819827867781687\n",
      "  neg_mean_loss: 3.819827867781687\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47057\n",
      "  time_since_restore: 10.77621078491211\n",
      "  time_this_iter_s: 0.10817480087280273\n",
      "  time_total_s: 10.77621078491211\n",
      "  timestamp: 1658500249\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: da1ff46c\n",
      "  warmup_time: 0.0030031204223632812\n",
      "  \n",
      "Result for objective_dc25c796:\n",
      "  date: 2022-07-22_15-30-52\n",
      "  done: false\n",
      "  experiment_id: c0f302c32b284f8e99dbdfa90657ee7d\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 94\n",
      "  iterations_since_restore: 95\n",
      "  mean_loss: -1.1817308993292515\n",
      "  neg_mean_loss: 1.1817308993292515\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47062\n",
      "  time_since_restore: 10.179337978363037\n",
      "  time_this_iter_s: 0.1043100357055664\n",
      "  time_total_s: 10.179337978363037\n",
      "  timestamp: 1658500252\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 95\n",
      "  trial_id: dc25c796\n",
      "  warmup_time: 0.002794981002807617\n",
      "  \n",
      "Result for objective_dc25c796:\n",
      "  date: 2022-07-22_15-30-53\n",
      "  done: true\n",
      "  experiment_id: c0f302c32b284f8e99dbdfa90657ee7d\n",
      "  experiment_tag: 10_height=-13.6110,steps=100,width=5.8246\n",
      "  hostname: Kais-MacBook-Pro.local\n",
      "  iterations: 99\n",
      "  iterations_since_restore: 100\n",
      "  mean_loss: -1.190635502081924\n",
      "  neg_mean_loss: 1.190635502081924\n",
      "  node_ip: 127.0.0.1\n",
      "  pid: 47062\n",
      "  time_since_restore: 10.721266031265259\n",
      "  time_this_iter_s: 0.10741806030273438\n",
      "  time_total_s: 10.721266031265259\n",
      "  timestamp: 1658500253\n",
      "  timesteps_since_restore: 0\n",
      "  training_iteration: 100\n",
      "  trial_id: dc25c796\n",
      "  warmup_time: 0.002794981002807617\n",
      "  \n"
     ]
    }
   ],
   "source": [
    "tuner = tune.Tuner(\n",
    "    objective,\n",
    "    tune_config=tune.TuneConfig(\n",
    "        metric=\"mean_loss\",\n",
    "        mode=\"min\",\n",
    "        search_alg=algo,\n",
    "        num_samples=num_samples,\n",
    "    ),\n",
    "    param_space=search_space,\n",
    ")\n",
    "results = tuner.fit()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "477f099b",
   "metadata": {},
   "source": [
    "Here are the hyperparamters found to minimize the mean loss of the defined objective."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3488aefa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Best hyperparameters found were:  {'steps': 100, 'width': 19.398197043239886, 'height': -95.88310114083951}\n"
     ]
    }
   ],
   "source": [
    "print(\"Best hyperparameters found were: \", results.get_best_result().config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "2936353a",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "ray.shutdown()"
   ]
  }
 ],
 "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.7.7"
  },
  "orphan": true
 },
 "nbformat": 4,
 "nbformat_minor": 5
}