File size: 3,074 Bytes
181b6d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash

chemprop_dir=../../../chemprop  # location of chemprop directory, CHANGE ME

results_dir=results_sampl
results_dir2=results_sampl_production
train_path=../data/logP/train.csv
val_path=../data/logP/val.csv
test_path=../data/logP/test.csv
path=../data/logP/logP_without_overlap.csv

#Hyperparameter optimization
python $chemprop_dir/hyperparameter_optimization.py \
--dataset_type regression \
--data_path $train_path \
--separate_val_path $val_path \
--separate_test_path $val_path \
--num_iters 30 \
--epochs 50 \
--aggregation norm \
--search_parameter_keywords depth ffn_num_layers  hidden_size ffn_hidden_size dropout \
--config_save_path $results_dir/config.json \
--hyperopt_checkpoint_dir $results_dir \
--log_dir $results_dir 

#Training with optimized hyperparameters
python $chemprop_dir/train.py \
--dataset_type regression \
--data_path $train_path \
--separate_val_path $val_path \
--separate_test_path $test_path \
--epochs 50 \
--aggregation norm \
--config_path $results_dir/config.json \
--save_dir $results_dir \
--ensemble_size 5 \
--save_preds \
--extra_metrics mae

#Train production model
python $chemprop_dir/train.py \
--dataset_type regression \
--data_path $path \
--separate_val_path $path \
--separate_test_path $path \
--epochs 40 \
--aggregation norm \
--config_path $results_dir/config.json \
--save_dir $results_dir2 \
--ensemble_size 5 

#Predict on Sample 6
python $chemprop_dir/predict.py \
--test_path "../data/logP/sampl6_experimental.csv" \
--preds_path $results_dir2/pred_SAMPL6.csv \
--checkpoint_dir $results_dir2 \
--smiles_column "Isomeric SMILES"

echo SAMPL6  >> $results_dir2/sampl.csv
python -c 'import pandas as pd; from sklearn import metrics; print("rmse", metrics.mean_squared_error(pd.read_csv("results_sampl_production/pred_SAMPL6.csv")["logP"],pd.read_csv("../data/logP/sampl6_experimental.csv")["logP mean"],squared=False))' >> $results_dir2/sampl.csv

#Predict on Sample 7
python $chemprop_dir/predict.py \
--test_path "../data/logP/sampl7_experimental.csv" \
--preds_path $results_dir2/pred_SAMPL7.csv \
--checkpoint_dir $results_dir2 \
--smiles_column "Isomeric SMILES"

echo SAMPL7 >> $results_dir2/sampl.csv
python -c 'import pandas as pd; from sklearn import metrics; print("rmse", metrics.mean_squared_error(pd.read_csv("results_sampl_production/pred_SAMPL7.csv")["logP"],pd.read_csv("../data/logP/sampl7_experimental.csv")["logP mean"],squared=False))' >> $results_dir2/sampl.csv

#Predict on Sample 9
python $chemprop_dir/predict.py \
--test_path "../data/logP/sampl9_experimental.csv" \
--preds_path $results_dir2/pred_SAMPL9.csv \
--checkpoint_dir $results_dir2 \
--smiles_column smiles

echo SAMPL9 >> $results_dir2/sampl.csv
python -c 'import pandas as pd; from sklearn import metrics; print("rmse", metrics.mean_squared_error(pd.read_csv("results_sampl_production/pred_SAMPL9.csv")["logP"],pd.read_csv("../data/logP/sampl9_experimental.csv")["new_logPexp_reviewed"],squared=False))' >> $results_dir2/sampl.csv

echo "Saved results to" $results_dir2"/sampl.csv"
cat  >> $results_dir2/sampl.csv