generated from AC-BO-Hackathon/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
219 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters