2
$\begingroup$

This is my first post here, just a brief presentation: my name is Gianmarco, I’m Medicinal Chemistry undergraduate student who is preparing his dissertation, my idea would be to create a classifier that can distinguish anticancer drugs as active or inactive and distinguish those active in three classes, describing the molecules as a graph. My supervisor suggested me to use the Random Forest classifier, to do this I need to convert my graph into a vector trying to keep as many characteristics as possible.

I start from a molecular graph dataset like this:

Data(x=[9, 9], edge_index=[2, 18], edge_attr=[18, 2], y=[0],
smiles='COC(=O)C=CN1CC1')

where x, edge_index and edge_attr are a torch tensor, and y is the label (0=inactive, 1=activity of class one, 2=activity of class two...). To run a random forest classifier I think I must to convert them into a vector like a np.array, but I have no idea how to do it, has anyone had experience on this task? Thanks!

$\endgroup$
1

1 Answer 1

1
$\begingroup$

To use methods like random forest, you need a fixed sized vector representation. The way you do this is up to you. You can flatten all the edge values, append any node or edge related extra features you have etc. But, all of your data vectors should have the same size. This might become trickier if you have variable size graphs, like molecules, e.g. each has different atoms, so the graphs vary in size.

You don't need to use torch data types to vectorize your data. You can just read your data directly from the source based on your flattening logic. Or, you can flatten each torch tensor with torch.flatten and concatenate. But, if the graph size of each data sample is different, you'll need to pad some of them.

Another approach that might be useful is graph neural networks. There are studies experimenting on molecular datasets, e.g. given a molecule, predict it is toxic or not. One example could be Adaptive GCN published in AAAI. Or, any other paper, that uses molecular datasets (e.g. SMILES, Tox21 etc.) could be useful, especially if they share code, e.g. a CNN approach.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.