Skip to content

Commit

Permalink
Skorch emulator (#89)
Browse files Browse the repository at this point in the history
This PR is a complete rewrite of the ExperimentalEmulator. It makes use of skorch to enable use of scikit-learn. This commit also removes some dead code and does some minor refactoring.
  • Loading branch information
marcosfelt authored Feb 19, 2021
1 parent 061470e commit be54b50
Show file tree
Hide file tree
Showing 181 changed files with 2,168 additions and 3,845 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -111,6 +112,7 @@ venv.bak/
~*.xlsx
*.DS_STORE
.vscode/
.idea/

# TSEMO
.TSEMO_DATA
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

Summit is a set of tools for optimising chemical processes. We’ve started by targeting reactions.


## What is Summit?
Currently, reaction optimisation in the fine chemicals industry is done by intuition or design of experiments. Both scale poorly with the complexity of the problem.

Expand Down
295 changes: 0 additions & 295 deletions docs/source/Tutorial_MIT_kin.ipynb

This file was deleted.

50 changes: 22 additions & 28 deletions docs/source/experiments_benchmarks/new_benchmarks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"source": [
"from summit.benchmarks import ExperimentalEmulator\n",
"from summit.domain import *\n",
"from summit.utils.dataset import DataSet"
"from summit.utils.dataset import DataSet\n",
"import pkg_resources\n",
"import pathlib\n",
"import pprint"
]
},
{
Expand Down Expand Up @@ -97,7 +100,7 @@
"<table id='domain' width=100%><tr><td><b>Name</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Values</b></td></tr><tr><td>catalyst</td><td>categorical, input</td><td>Catalyst type - different ligands</td><td>8 levels</td></tr><tr><td>t_res</td><td>continuous, input</td><td>Residence time in seconds (s)</td><td>[60,600]</td></tr><tr><td>temperature</td><td>continuous, input</td><td>Reactor temperature in degrees Celsius (ºC)</td><td>[30,110]</td></tr><tr><td>catalyst_loading</td><td>continuous, input</td><td>Catalyst loading in mol%</td><td>[0.5,2.5]</td></tr><tr><td>ton</td><td>continuous, maximize objective</td><td>Turnover number - moles product generated divided by moles catalyst used</td><td>[0,200]</td></tr><tr><td>yield</td><td>continuous, maximize objective</td><td>Yield</td><td>[0,100]</td></tr></table>"
],
"text/plain": [
"<summit.domain.Domain at 0x153eca5f8>"
"<summit.domain.Domain at 0x13483f8d0>"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -173,7 +176,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If you are running this yourself, uncomment the second line."
"Here, we import the data that we already have in the Summit package, but you could use your own data. Change verbose to 1 if you want streaming updates of the training."
]
},
{
Expand All @@ -182,19 +185,10 @@
"metadata": {},
"outputs": [],
"source": [
"import pathlib \n",
"FOLDER = pathlib.Path(\"../_static/\") # When using this in the context of docs\n",
"# FOLDER = pathlib.Path(\".\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emul = ExperimentalEmulator(domain=domain, model_name='my_reizman')\n",
"emul.train(csv_dataset=FOLDER / \"reizman_suzuki_case1_train_test.csv\", cv_fold=2, test_size=0.25)"
"DATA_PATH = pathlib.Path(pkg_resources.resource_filename(\"summit\", \"benchmarks/data\"))\n",
"ds = DataSet.read_csv(DATA_PATH / \"reizman_suzuki_case_1.csv\",)\n",
"emul = ExperimentalEmulator(model_name='my_reizman', domain=domain, dataset=ds)\n",
"res = emul.train(max_epochs=100, cv_fold=2, test_size=0.25, verbose=0)"
]
},
{
Expand All @@ -206,7 +200,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -215,10 +209,10 @@
"<table id='domain' width=100%><tr><td><b>Name</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Values</b></td></tr><tr><td>catalyst</td><td>categorical, input</td><td>Catalyst type - different ligands</td><td>8 levels</td></tr><tr><td>t_res</td><td>continuous, input</td><td>Residence time in seconds (s)</td><td>[60,600]</td></tr><tr><td>temperature</td><td>continuous, input</td><td>Reactor temperature in degrees Celsius (ºC)</td><td>[30,110]</td></tr><tr><td>catalyst_loading</td><td>continuous, input</td><td>Catalyst loading in mol%</td><td>[0.5,2.5]</td></tr><tr><td>ton</td><td>continuous, maximize objective</td><td>Turnover number - moles product generated divided by moles catalyst used</td><td>[0,200]</td></tr><tr><td>yield</td><td>continuous, maximize objective</td><td>Yield</td><td>[0,100]</td></tr></table>"
],
"text/plain": [
"<summit.domain.Domain at 0x153eca5f8>"
"<summit.domain.Domain at 0x13483f8d0>"
]
},
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -229,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -271,27 +265,27 @@
" <td>60</td>\n",
" <td>100</td>\n",
" <td>1.0</td>\n",
" <td>29.972519</td>\n",
" <td>43.924999</td>\n",
" <td>23.364954</td>\n",
" <td>33.13002</td>\n",
" <td>0.0</td>\n",
" <td>0.063283</td>\n",
" <td>0.058378</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"NAME catalyst t_res temperature catalyst_loading ton yield \\\n",
"TYPE DATA DATA DATA DATA DATA DATA \n",
"0 P1-L1 60 100 1.0 29.972519 43.924999 \n",
"NAME catalyst t_res temperature catalyst_loading ton yield \\\n",
"TYPE DATA DATA DATA DATA DATA DATA \n",
"0 P1-L1 60 100 1.0 23.364954 33.13002 \n",
"\n",
"NAME computation_t experiment_t strategy \n",
"TYPE METADATA METADATA METADATA \n",
"0 0.0 0.063283 NaN "
"0 0.0 0.058378 NaN "
]
},
"execution_count": 8,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
Binary file removed docs/source/kinetic_model.png
Binary file not shown.
Loading

0 comments on commit be54b50

Please sign in to comment.