Skip to content

Commit e9f239e

Browse files
committed
refine readme for gni
1 parent 759e456 commit e9f239e

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

README.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,38 +156,68 @@ These can be used for both GAT and ResGated architectures:
156156
--model.n_linear_layers=2 # Default: 1
157157
```
158158

159-
## Random Node Initialization
160159

161160

161+
# Random Node Initialization
162162

163+
## Static Node Initialization
163164

165+
In this type of node initialization, the node properties (and/or edge properties) of the given molecular graph are initialized only once during dataset creation with the given initialization scheme.
164166

165167

166-
### Static Node Intialization
168+
```
169+
python -m chebai fit --trainer=configs/training/default_trainer.yml --trainer.logger=configs/training/wandb_logger.yml --model=../python-chebai-graph/configs/model/resgated.yml --model.config.in_channels=203 --model.config.edge_dim=11 --model.train_metrics=configs/metrics/micro-macro-f1.yml --model.test_metrics=configs/metrics/micro-macro-f1.yml --model.val_metrics=configs/metrics/micro-macro-f1.yml --data=../python-chebai-graph/configs/data/chebi50_graph_properties.yml --data.pad_node_features=45 --data.pad_edge_features=4 --data.init_args.batch_size=128 --trainer.accumulate_grad_batches=4 --data.init_args.num_workers=10 --data.init_args.persistent_workers=False --model.pass_loss_kwargs=false --data.init_args.chebi_version=241 --trainer.min_epochs=200 --trainer.max_epochs=200 --model.criterion=configs/loss/bce.yml --trainer.logger.init_args.name=gni_res_props+zeros_s0
170+
```
167171

168-
In this type of node initialization, the node properties ( and/or edge properties) of the given molecular graph is initialized only once during dataset creation with given node initiliazation scheme.
172+
In the above config, for each node we use the 158 node properties retrieved from RDKit and add 45 additional features (specified by `--data.pad_node_features=45`) drawn from a normal distribution (default). You can change the distribution using:
169173

174+
```
175+
--data.distribution=zeros
176+
```
170177

171-
In the below config, for each node we the 158 node properties we retrieve from RDKit along and add 54 features to node (specified by `--data.pad_node_features=45`) which is drawn from normal distribution (by default.) You can change the distribution from which additional features are drawn by using `--data.distribution=zeros`
178+
Available distributions:
172179

173-
below are the available distributions:
180+
```
174181
["normal", "uniform", "xavier_normal", "xavier_uniform", "zeros"]
182+
```
183+
184+
Similarly, each edge is initialized with 7 RDKit properties and 4 additional features drawn from the given distribution.
175185

176-
Similary, each edge is initializaed with 7 properties from RDKit and 4 additional features drawn from given distribution.
177186

187+
If you want all node (and edge) features to be drawn from a given distribution (i.e., ignore RDKit features), use:
178188

179189
```
180-
python -m chebai fit --trainer=configs/training/default_trainer.yml --trainer.logger=configs/training/wandb_logger.yml --model=../python-chebai-graph/configs/model/resgated.yml --model.config.in_channels=203 --model.config.edge_dim=11 --model.train_metrics=configs/metrics/micro-macro-f1.yml --model.test_metrics=configs/metrics/micro-macro-f1.yml --model.val_metrics=configs/metrics/micro-macro-f1.yml --data=../python-chebai-graph/configs/data/chebi50_graph_properties.yml --data.pad_node_features=45 --data.pad_edge_features=4 --data.init_args.batch_size=128 --trainer.accumulate_grad_batches=4 --data.init_args.num_workers=10 --data.init_args.persistent_workers=False --model.pass_loss_kwargs=false --data.init_args.chebi_version=241 --trainer.min_epochs=200 --trainer.max_epochs=200 --model.criterion=configs/loss/bce.yml --trainer.logger.init_args.name=gni_res_props+zeros_s0
190+
--data=../python-chebai-graph/configs/data/chebi50_static_gni.yml
181191
```
182192

183-
if you to use all the features for node (and edge) drawn from given distribution, use the data class
184-
`--data=../python-chebai-graph/configs/data/chebi50_static_gni.yml` . Refer the data class code.
193+
Refer to the data class code for details.
185194

186-
### Dynamic Node Initialization
187-
In this type of node initialization, the node properties ( and/or edge properties) of the given molecular graph is initialized at each forward pass of the model with given node initiliazation scheme.
188195

196+
## Dynamic Node Initialization
189197

190-
```bash
198+
In this type of node initialization, the node properties (and/or edge properties) of the molecular graph are initialized at **each forward pass** of the model using the given initialization scheme.
199+
200+
Currently, dynamic node initialization is implemented only for the **resgated** architecture by specifying:
201+
202+
```
203+
--model=../python-chebai-graph/configs/model/resgated_dynamic_gni.yml
204+
```
205+
206+
To keep RDKit features and *add* dynamically initialized features:
207+
208+
```
209+
--model.config.complete_randomness=False
210+
--model.config.pad_node_features=45
211+
```
191212

213+
The additional features are drawn from normal distribution (default). You can change it using:
214+
215+
```
216+
--model.config.distribution=uniform
217+
```
218+
219+
If all features should be initialized from the given distribution, remove the complete_randomness flag (default is True).
220+
221+
```
192222
python -m chebai fit --trainer=configs/training/default_trainer.yml --trainer.logger=configs/training/wandb_logger.yml --model=../python-chebai-graph/configs/model/resgated_dynamic_gni.yml --model.config.in_channels=203 --model.config.edge_dim=11 --model.config.complete_randomness=False --model.config.pad_node_features=45 --model.config.pad_edge_features=4 --model.train_metrics=configs/metrics/micro-macro-f1.yml --model.test_metrics=configs/metrics/micro-macro-f1.yml --model.val_metrics=configs/metrics/micro-macro-f1.yml --data=../python-chebai-graph/configs/data/chebi50_graph_properties.yml --data.init_args.batch_size=128 --trainer.accumulate_grad_batches=4 --data.init_args.num_workers=10 --data.init_args.persistent_workers=False --model.pass_loss_kwargs=false --data.init_args.chebi_version=241 --trainer.min_epochs=200 --trainer.max_epochs=200 --model.criterion=configs/loss/bce.yml --trainer.logger.init_args.name=gni_dres_props+rand_s0
193223
```

0 commit comments

Comments
 (0)