MingyuanXu / Tree-Invent

Tree-Invent: A novel molecular generative model constrained with topological tree
11 stars 4 forks source link

Usagse about Activity_RL_example #1

Closed hirose125 closed 1 year ago

hirose125 commented 1 year ago

@MingyuanXu san

Hello. I'm interested in tree invent and am considering using it. I've been looking at the Activity_RL_example in the TreeInvent-Community. When incorporating a target property into the scoring function, should I modify the following part to my custom model? Also, is it possible to use a regression model instead of a classification model?

def compute_activity(self, mols, activity_model): """ Note: this function may have to be tuned/replicated depending on how the activity model is saved. Args:

mols (list) : Contains rdkit.Mol objects corresponding to molecular graphs sampled. activity_model (sklearn.svm.classes.SVC) : Pre-trained QSAR model. Returns:

activity (list) : Contains predicted activities for input molecules. """ nmols = len(mols) activity = torch.zeros(nmols, device=self.device) for idx, mol in enumerate(mols):

try:

if mol: fingerprint = AllChem.GetMorganFingerprintAsBitVect(mol, 2, nBits=2048) ecfp4 = np.zeros((2048,)) DataStructs.ConvertToNumpyArray(fingerprint, ecfp4)

print (activity_model.predict_proba([ecfp4]))

activity[idx] = activity_model.predict_proba([ecfp4])[0][1]

print(activity)

except:

pass # activity[idx] will remain 0.0

return activity``

MingyuanXu commented 1 year ago

Thanks for comments! Tree-Invent supports use the continuous score for RL and it should be rescaled into 0~1. Common scores like docking scores, QSAR activity, molecular similarity have been supported in Tree-Invent. You can also modified the part you mentioned to use any regression models as RL scores. Is your regression model common for drug designs? I could directly add it into Tree-Invent.

hirose125 commented 1 year ago

Thank you for your response. The value I want to predict is not related to the properties of drug design, but it's about general material properties like solubility. So, what you're saying is that if we normalize the output of any regression model and scale it within the range of 0-1, we can utilize it. Thank you, I plan to proceed with validation.

MingyuanXu commented 1 year ago

Good Luck!Are there any general methods for solubility predictions?

hirose125 commented 1 year ago

Thank you. I will make surrogate model from data of solubility.