diff --git a/BayBE_basic.ipynb b/BayBE_basic.ipynb new file mode 100644 index 0000000..be1cf97 --- /dev/null +++ b/BayBE_basic.ipynb @@ -0,0 +1,193 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Import filtered data set" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "df_AA2024 = pd.read_excel('data/filtered_AA2024.xlsx')" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Time_h pH Inhib_Concentrat_M Efficiency\n", + "count 611.000000 611.000000 611.000000 611.000000\n", + "mean 135.801964 6.342062 0.006808 26.736841\n", + "std 201.683867 2.529080 0.014059 288.788317\n", + "min 0.500000 0.000000 0.000010 -4834.000000\n", + "25% 24.000000 4.000000 0.000500 30.000000\n", + "50% 24.000000 7.000000 0.001000 58.000000\n", + "75% 144.000000 7.000000 0.003000 87.950000\n", + "max 672.000000 10.000000 0.100000 100.000000\n" + ] + } + ], + "source": [ + "print(df_AA2024.describe())\n" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " SMILES Time_h pH Inhib_Concentrat_M \\\n", + "0 COCCOC(=O)OCSc1nc2c(s1)cccc2 24.0 4.0 0.001 \n", + "1 COCCOC(=O)OCSc1nc2c(s1)cccc2 24.0 10.0 0.001 \n", + "2 Cc1ccc(c(c1)n1nc2c(n1)cccc2)O 24.0 4.0 0.001 \n", + "3 Cc1ccc(c(c1)n1nc2c(n1)cccc2)O 24.0 10.0 0.001 \n", + "4 Clc1ccc(cc1)CC[C@](C(C)(C)C)(Cn1cncn1)O 24.0 4.0 0.001 \n", + "\n", + " Efficiency \n", + "0 0.0 \n", + "1 0.0 \n", + "2 30.0 \n", + "3 30.0 \n", + "4 30.0 \n" + ] + } + ], + "source": [ + "print(df_AA2024.head())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Set objectives and parameters in BayBE to define the search space" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [], + "source": [ + "from baybe.targets import NumericalTarget\n", + "from baybe.objective import Objective\n", + "\n", + "target = NumericalTarget(\n", + " name=\"Efficiency\",\n", + " mode=\"MAX\",\n", + ")\n", + "objective = Objective(mode=\"SINGLE\", targets=[target])" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [], + "source": [ + "from baybe.parameters import (\n", + " NumericalContinuousParameter,\n", + ")\n", + "\n", + "parameters = [\n", + " NumericalContinuousParameter(\n", + " name=\"Time[h]\",\n", + " bounds=(0.500000, 672),\n", + " ),\n", + " NumericalContinuousParameter(\n", + " name=\"pH\",\n", + " bounds=(1, 14),\n", + " ),\n", + "]" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [], + "source": [ + "from baybe.searchspace import SearchSpace\n", + "\n", + "searchspace = SearchSpace.from_product(parameters)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Run the campaign" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [], + "source": [ + "from baybe import Campaign\n", + "\n", + "campaign = Campaign(searchspace, objective)" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Time[h] pH\n", + "0 638.310058 2.638211\n", + "1 475.753030 2.599470\n", + "2 452.512074 4.018597\n" + ] + } + ], + "source": [ + "df = campaign.recommend(batch_size=3)\n", + "print(df)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.12" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/baybe-inhibitor.ipynb b/baybe-inhibitor.ipynb index 23329e4..2a932e6 100644 --- a/baybe-inhibitor.ipynb +++ b/baybe-inhibitor.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -11,29 +11,44 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "df_AA2024 = pd.read_excel('data/filtered_AA2024.xlsx')" + ] + }, + { + "cell_type": "code", + "execution_count": 3, "metadata": {}, "outputs": [ { - "name": "stderr", + "name": "stdout", "output_type": "stream", "text": [ - "/home/vscode/.local/lib/python3.10/site-packages/baybe/telemetry.py:222: UserWarning: WARNING: BayBE Telemetry endpoint https://public.telemetry.baybe.p.uptimize.merckgroup.com:4317 cannot be reached. Disabling telemetry. The exception encountered was: ConnectionError, HTTPConnectionPool(host='verkehrsnachrichten.merck.de', port=80): Max retries exceeded with url: / (Caused by NameResolutionError(\": Failed to resolve 'verkehrsnachrichten.merck.de' ([Errno -2] Name or service not known)\"))\n", - " warnings.warn(\n", - "/home/vscode/.local/lib/python3.10/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" + " Time_h pH Inhib_Concentrat_M Efficiency\n", + "count 611.000000 611.000000 611.000000 611.000000\n", + "mean 135.801964 6.342062 0.006808 26.736841\n", + "std 201.683867 2.529080 0.014059 288.788317\n", + "min 0.500000 0.000000 0.000010 -4834.000000\n", + "25% 24.000000 4.000000 0.000500 30.000000\n", + "50% 24.000000 7.000000 0.001000 58.000000\n", + "75% 144.000000 7.000000 0.003000 87.950000\n", + "max 672.000000 10.000000 0.100000 100.000000\n" ] } ], "source": [ - "import pandas as pd\n", - "import numpy as np\n", - "from baybe import Campaign" + "print(df_AA2024.describe())" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [