thomasstruble / site_selectivity

Multitask prediction model for aromatic CH functionalization reactions
GNU General Public License v3.0
4 stars 1 forks source link

Q: Training the WLN model #6

Open NicolaiRee opened 3 years ago

NicolaiRee commented 3 years ago

Hi Thomas and Connor,

I am trying to use this network to train on my own data set to directly compare this network to other methods. Currently, I have this exact network running in TensorFlow 2.5, with inspiration from your other work: https://github.com/connorcoley/rexgen_direct and https://github.com/yanfeiguan/reactivity_predictions_substitution. However, I have some trouble finding out how the labels and predictions are handled in the training. If I pass in a batch of 1, the network correctly outputs an array with scores for all atoms in the SMILES and the labels match. However, when I pass in a batch larger than 1 the output array of the model is larger than the size of the labels, as the shape of bin_features is determined by the molecule with the largest number of atoms (max_natoms).

Would it be possible for you to share the code or details on how this exact network is trained, in order to reproduce the really cool results you get?

Kind regards, Nicolai

thomasstruble commented 3 years ago

I will look around and see if I can push some code. I have tried to modernize the mutlitask network into tensorflow>=2.0 before without much success. I can be done but will take a little extra work. The code we used will only work with the pinned version of tf and was very similar to the rexgen code simply with a multitask component added for training.

NicolaiRee commented 3 years ago

Hi Thomas, Thank you for this really fast reply. That would be really great! I guess my main question is how this network is trained to predicts scores for all of the atoms in the SMILES and not just scores for each graph edit as with the rexgen code. One of the strengths I see in this code is that you only need to give it a SMILES of the reactant in order for the model to predict scores for all atoms, which makes it really easy to use.

I have attached here the code that should mimic this exact network (for single task as n_task is just set to 1) and runs in tensorflow>=2.0 for the forward passing, if it is of any interest :-) site-selectivity.zip

NicolaiRee commented 2 years ago

Hi Thomas, Is there any news on this? Best wishes, Nicolai