Skip to content

Commit 8f5ea0c

Browse files
committed
Updating RL notebooks.
1 parent 8ba2471 commit 8f5ea0c

6 files changed

+59
-56
lines changed

.idea/misc.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

notebooks/Reinforcement_Learning_Demo.ipynb

+18-18
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"metadata": {},
66
"source": [
77
"> **How to run this notebook (command-line)?**\n",
8-
"1. Install the `reinvent_shared.v2.1` environment:\n",
8+
"1. Install the `ReinventCommunity` environment:\n",
99
"`conda env create -f reinvent_shared.yml`\n",
1010
"2. Activate the environment:\n",
11-
"`conda activate reinvent_shared.v2.1`\n",
11+
"`conda activate ReinventCommunity`\n",
1212
"3. Execute `jupyter`:\n",
1313
"`jupyter notebook`\n",
1414
"4. Copy the link to a browser\n",
1515
"\n",
1616
"\n",
17-
"# `REINVENT 2.0`: reinforcement learning demo\n",
17+
"# `REINVENT 3.0`: reinforcement learning demo\n",
1818
"The aim of this notebook is to illustrate how `REINVENT` can be used for the _de novo_ design of molecules in a *Reinforcement Learning* (RL) setup. The general idea is to start with a (somewhat) focussed prior and to define a (complex) scoring function from a set of building blocks (*components*) to decide which molecules are \"good\" or \"bad\". Each molecule generated by the _agent_ will thus receive a score from 0 to 1 and this feedback is used to train the agent over time, i.e. to focus it on chemical regions of interest for a given project.\n",
1919
"\n",
2020
"![](img/REINVENT_RL_mode.png)\n",
@@ -45,7 +45,7 @@
4545
},
4646
{
4747
"cell_type": "code",
48-
"execution_count": 1,
48+
"execution_count": 10,
4949
"metadata": {},
5050
"outputs": [],
5151
"source": [
@@ -56,8 +56,8 @@
5656
"import tempfile\n",
5757
"\n",
5858
"# --------- change these path variables as required\n",
59-
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_2.0/Reinvent\")\n",
60-
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v2.1\")\n",
59+
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_3.0/Reinvent\")\n",
60+
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v.3.0\")\n",
6161
"output_dir = os.path.expanduser(\"~/Desktop/REINVENT_RL_demo\")\n",
6262
"\n",
6363
"# --------- do not change\n",
@@ -82,7 +82,7 @@
8282
},
8383
{
8484
"cell_type": "code",
85-
"execution_count": 2,
85+
"execution_count": 3,
8686
"metadata": {},
8787
"outputs": [],
8888
"source": [
@@ -104,14 +104,14 @@
104104
},
105105
{
106106
"cell_type": "code",
107-
"execution_count": 3,
107+
"execution_count": 4,
108108
"metadata": {},
109109
"outputs": [],
110110
"source": [
111111
"# add block to specify whether to run locally or not and\n",
112112
"# where to store the results and logging\n",
113113
"configuration[\"logging\"] = {\n",
114-
" \"sender\": \"http://127.0.0.1\", # only relevant if \"recipient\" is set to \"remote\"\n",
114+
" \"sender\": \"0.0.0.0\", # only relevant if \"recipient\" is set to \"remote\"\n",
115115
" \"recipient\": \"local\", # either to local logging or use a remote REST-interface\n",
116116
" \"logging_frequency\": 10, # log every x-th steps\n",
117117
" \"logging_path\": os.path.join(output_dir, \"progress.log\"), # load this folder in tensorboard\n",
@@ -134,7 +134,7 @@
134134
},
135135
{
136136
"cell_type": "code",
137-
"execution_count": 4,
137+
"execution_count": 5,
138138
"metadata": {},
139139
"outputs": [],
140140
"source": [
@@ -146,7 +146,7 @@
146146
" \"name\": \"IdenticalMurckoScaffold\", # other options are: \"IdenticalTopologicalScaffold\", \n",
147147
" # \"NoFilter\" and \"ScaffoldSimilarity\"\n",
148148
" # -> use \"NoFilter\" to disable this feature\n",
149-
" \"nbmax\": 25, # the bin size; penalization will start once this is exceeded\n",
149+
" \"bucket_size\": 25, # the bin size; penalization will start once this is exceeded\n",
150150
" \"minscore\": 0.4, # the minimum total score to be considered for binning\n",
151151
" \"minsimilarity\": 0.4 # the minimum similarity to be placed into the same bin\n",
152152
"}\n",
@@ -186,7 +186,7 @@
186186
},
187187
{
188188
"cell_type": "code",
189-
"execution_count": 5,
189+
"execution_count": 6,
190190
"metadata": {},
191191
"outputs": [],
192192
"source": [
@@ -289,7 +289,7 @@
289289
},
290290
{
291291
"cell_type": "code",
292-
"execution_count": 6,
292+
"execution_count": 7,
293293
"metadata": {},
294294
"outputs": [],
295295
"source": [
@@ -309,7 +309,7 @@
309309
"The command-line execution looks like this:\n",
310310
"```\n",
311311
"# activate envionment\n",
312-
"conda activate reinvent_shared.v2.1\n",
312+
"conda activate reinvent_shared.v.3.0\n",
313313
"\n",
314314
"# execute REINVENT\n",
315315
"python <your_path>/input.py <config>.json\n",
@@ -318,7 +318,7 @@
318318
},
319319
{
320320
"cell_type": "code",
321-
"execution_count": 7,
321+
"execution_count": 8,
322322
"metadata": {},
323323
"outputs": [],
324324
"source": [
@@ -330,7 +330,7 @@
330330
},
331331
{
332332
"cell_type": "code",
333-
"execution_count": 8,
333+
"execution_count": 9,
334334
"metadata": {},
335335
"outputs": [],
336336
"source": [
@@ -455,7 +455,7 @@
455455
"cd <your_path>/REINVENT_RL_demo\n",
456456
"\n",
457457
"# make sure, you have activated the proper environment\n",
458-
"conda activate reinvent_shared.v2.1\n",
458+
"conda activate reinvent_shared.v.3.0\n",
459459
"\n",
460460
"# start tensorboard\n",
461461
"tensorboard --logdir progress.log\n",
@@ -533,7 +533,7 @@
533533
"name": "python",
534534
"nbconvert_exporter": "python",
535535
"pygments_lexer": "ipython3",
536-
"version": "3.7.6"
536+
"version": "3.7.3"
537537
}
538538
},
539539
"nbformat": 4,

notebooks/Reinforcement_Learning_Demo_Selectivity.ipynb

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"metadata": {},
66
"source": [
77
"> **How to run this notebook (command-line)?**\n",
8-
"1. Install the `reinvent_shared.v2.1` environment:\n",
8+
"1. Install the `ReinventCommunity` environment:\n",
99
"`conda env create -f reinvent_shared.yml`\n",
1010
"2. Activate the environment:\n",
11-
"`conda activate reinvent_shared.v2.1`\n",
11+
"`conda activate ReinventCommunity`\n",
1212
"3. Execute `jupyter`:\n",
1313
"`jupyter notebook`\n",
1414
"4. Copy the link to a browser\n",
1515
"\n",
1616
"\n",
17-
"# `REINVENT 2.0`: reinforcement learning selectivity demo\n",
17+
"# `REINVENT 3.0`: reinforcement learning selectivity demo\n",
1818
"This illustrates the use of a selectivity score component. This component is normally used in a scenario where ligands are designed to bind to a concrete target and at the same time should not be binding to one or more off-targets. The example here looks at a single off-target case.\n",
1919
"\n",
2020
"We will demonstrate how to set up a `REINVENT` run that optimizes molecules to be selective against _Aurora_ kinase by minimizing at the same time their affinity to _B RAF_ kinase.\n",
@@ -32,7 +32,7 @@
3232
},
3333
{
3434
"cell_type": "code",
35-
"execution_count": 1,
35+
"execution_count": 2,
3636
"metadata": {},
3737
"outputs": [],
3838
"source": [
@@ -43,8 +43,8 @@
4343
"import tempfile\n",
4444
"\n",
4545
"# --------- change these path variables as required\n",
46-
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_2.0/Reinvent\")\n",
47-
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v2.1\")\n",
46+
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_3.0/Reinvent\")\n",
47+
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v.3.0\")\n",
4848
"output_dir = os.path.expanduser(\"~/Desktop/REINVENT_RL_demo\")\n",
4949
"\n",
5050
"# --------- do not change\n",
@@ -155,7 +155,7 @@
155155
" \"name\": \"IdenticalMurckoScaffold\", # other options are: \"IdenticalTopologicalScaffold\", \n",
156156
" # \"NoFilter\" and \"ScaffoldSimilarity\"\n",
157157
" # -> use \"NoFilter\" to disable this feature\n",
158-
" \"nbmax\": 25, # the bin size; penalization will start once this is exceeded\n",
158+
" \"bucket_size\": 25, # the bin size; penalization will start once this is exceeded\n",
159159
" \"minscore\": 0.4, # the minimum total score to be considered for binning\n",
160160
" \"minsimilarity\": 0.4 # the minimum similarity to be placed into the same bin\n",
161161
"}"
@@ -398,7 +398,7 @@
398398
"The command-line execution looks like this:\n",
399399
"```\n",
400400
"# activate envionment\n",
401-
"conda activate reinvent_shared.v2.1\n",
401+
"conda activate reinvent_shared.v.3.0\n",
402402
"\n",
403403
"# execute REINVENT\n",
404404
"python <your_path>/input.py <config>.json\n",
@@ -544,7 +544,7 @@
544544
"cd <your_path>/REINVENT_RL_demo\n",
545545
"\n",
546546
"# make sure, you have activated the proper environment\n",
547-
"conda activate reinvent_shared.v2.1\n",
547+
"conda activate reinvent_shared.v.3.0\n",
548548
"\n",
549549
"# start tensorboard\n",
550550
"tensorboard --logdir progress.log\n",
@@ -622,7 +622,7 @@
622622
"name": "python",
623623
"nbconvert_exporter": "python",
624624
"pygments_lexer": "ipython3",
625-
"version": "3.7.6"
625+
"version": "3.7.3"
626626
}
627627
},
628628
"nbformat": 4,

notebooks/Reinforcement_Learning_Demo_Simple_Tanimoto.ipynb

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"metadata": {},
66
"source": [
77
"> **How to run this notebook (command-line)?**\n",
8-
"1. Install the `reinvent_shared.v2.1` environment:\n",
8+
"1. Install the `ReinventCommunity` environment:\n",
99
"`conda env create -f reinvent_shared.yml`\n",
1010
"2. Activate the environment:\n",
11-
"`conda activate reinvent_shared.v2.1`\n",
11+
"`conda activate ReinventCommunity`\n",
1212
"3. Execute `jupyter`:\n",
1313
"`jupyter notebook`\n",
1414
"4. Copy the link to a browser\n",
1515
"\n",
1616
"\n",
17-
"# `REINVENT 2.0`: reinforcement learning with tanimoto similarity\n",
17+
"# `REINVENT 3.0`: reinforcement learning with tanimoto similarity\n",
1818
"\n",
1919
"\n",
2020
"This is a simple example of running `Reinvent` with only 1 score component.\n",
@@ -32,7 +32,7 @@
3232
},
3333
{
3434
"cell_type": "code",
35-
"execution_count": 13,
35+
"execution_count": 2,
3636
"metadata": {},
3737
"outputs": [],
3838
"source": [
@@ -43,8 +43,8 @@
4343
"import tempfile\n",
4444
"\n",
4545
"# --------- change these path variables as required\n",
46-
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_2.0/Reinvent\")\n",
47-
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v2.1\")\n",
46+
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_3.0/Reinvent\")\n",
47+
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v.3.0\")\n",
4848
"output_dir = os.path.expanduser(\"~/Desktop/REINVENT_RL_demo\")\n",
4949
"\n",
5050
"# --------- do not change\n",
@@ -155,7 +155,7 @@
155155
" \"name\": \"IdenticalMurckoScaffold\", # other options are: \"IdenticalTopologicalScaffold\", \n",
156156
" # \"NoFilter\" and \"ScaffoldSimilarity\"\n",
157157
" # -> use \"NoFilter\" to disable this feature\n",
158-
" \"nbmax\": 25, # the bin size; penalization will start once this is exceeded\n",
158+
" \"bucket_size\": 25, # the bin size; penalization will start once this is exceeded\n",
159159
" \"minscore\": 0.4, # the minimum total score to be considered for binning\n",
160160
" \"minsimilarity\": 0.4 # the minimum similarity to be placed into the same bin\n",
161161
"}"
@@ -294,7 +294,7 @@
294294
"The command-line execution looks like this:\n",
295295
"```\n",
296296
"# activate envionment\n",
297-
"conda activate reinvent_shared.v2.1\n",
297+
"conda activate reinvent_shared.v.3.0\n",
298298
"\n",
299299
"# execute REINVENT\n",
300300
"python <your_path>/input.py <config>.json\n",
@@ -440,7 +440,7 @@
440440
"cd <your_path>/REINVENT_RL_demo\n",
441441
"\n",
442442
"# make sure, you have activated the proper environment\n",
443-
"conda activate reinvent_shared.v2.1\n",
443+
"conda activate reinvent_shared.v.3.0\n",
444444
"\n",
445445
"# start tensorboard\n",
446446
"tensorboard --logdir progress.log\n",
@@ -518,7 +518,7 @@
518518
"name": "python",
519519
"nbconvert_exporter": "python",
520520
"pygments_lexer": "ipython3",
521-
"version": "3.7.6"
521+
"version": "3.7.3"
522522
}
523523
},
524524
"nbformat": 4,

notebooks/Reinforcement_Learning_Exploitation_Demo.ipynb

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"metadata": {},
66
"source": [
77
"> **How to run this notebook (command-line)?**\n",
8-
"1. Install the `reinvent_shared.v2.1` environment:\n",
8+
"1. Install the `ReinventCommunity` environment:\n",
99
"`conda env create -f reinvent_shared.yml`\n",
1010
"2. Activate the environment:\n",
11-
"`conda activate reinvent_shared.v2.1`\n",
11+
"`conda activate ReinventCommunity`\n",
1212
"3. Execute `jupyter`:\n",
1313
"`jupyter notebook`\n",
1414
"4. Copy the link to a browser\n",
1515
"\n",
1616
"\n",
17-
"# `REINVENT 2.0`: reinforcement learning exploitation demo\n",
17+
"# `REINVENT 3.0`: reinforcement learning exploitation demo\n",
1818
"This demo illustrates how to set up a `REINVENT` run to optimize molecules that are active against _Aurora_ kinase. We use here predictive model as the main component to guide the generation of the molecules. we also include a `qed_score` component to stimulate the generation of more \"drug-like\" molecules.\n",
1919
"\n",
2020
"\n"
@@ -41,8 +41,8 @@
4141
"import tempfile\n",
4242
"\n",
4343
"# --------- change these path variables as required\n",
44-
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_2.0/Reinvent\")\n",
45-
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v2.1\")\n",
44+
"reinvent_dir = os.path.expanduser(\"~/Desktop/Projects/Publications/2020/2020-04_REINVENT_3.0/Reinvent\")\n",
45+
"reinvent_env = os.path.expanduser(\"~/miniconda3/envs/reinvent_shared.v.3.0\")\n",
4646
"output_dir = os.path.expanduser(\"~/Desktop/REINVENT_RL_demo\")\n",
4747
"\n",
4848
"# --------- do not change\n",
@@ -155,7 +155,7 @@
155155
" \"name\": \"NoFilter\", # other options are: \"IdenticalTopologicalScaffold\", \n",
156156
" # \"IdenticalMurckoScaffold\" and \"ScaffoldSimilarity\"\n",
157157
" # -> use \"NoFilter\" to disable this feature\n",
158-
" \"nbmax\": 25, # the bin size; penalization will start once this is exceeded\n",
158+
" \"bucket_size\": 25, # the bin size; penalization will start once this is exceeded\n",
159159
" \"minscore\": 0.4, # the minimum total score to be considered for binning\n",
160160
" \"minsimilarity\": 0.4 # the minimum similarity to be placed into the same bin\n",
161161
"}"
@@ -358,7 +358,7 @@
358358
"The command-line execution looks like this:\n",
359359
"```\n",
360360
"# activate envionment\n",
361-
"conda activate reinvent_shared.v2.1\n",
361+
"conda activate reinvent_shared.v.3.0\n",
362362
"\n",
363363
"# execute REINVENT\n",
364364
"python <your_path>/input.py <config>.json\n",
@@ -504,7 +504,7 @@
504504
"cd <your_path>/REINVENT_RL_demo\n",
505505
"\n",
506506
"# make sure, you have activated the proper environment\n",
507-
"conda activate reinvent_shared.v2.1\n",
507+
"conda activate reinvent_shared.v.3.0\n",
508508
"\n",
509509
"# start tensorboard\n",
510510
"tensorboard --logdir progress.log\n",
@@ -584,7 +584,7 @@
584584
"name": "python",
585585
"nbconvert_exporter": "python",
586586
"pygments_lexer": "ipython3",
587-
"version": "3.7.6"
587+
"version": "3.7.3"
588588
}
589589
},
590590
"nbformat": 4,

0 commit comments

Comments
 (0)