def _setup_graphs_mols(self): """Setup graphs and smiles if needed.""" smiles_to_mol = functools.partial(featurization.smiles_to_mol, infer_hydrogens=True) tensorizer = featurization.MolTensorizer(preprocess_fn=smiles_to_mol) smiles = ['CO', 'CCC', 'CN1C=NC2=C1C(=O)N(C(=O)N2C)C'] mols = [smiles_to_mol(smi) for smi in smiles] graphs = graph_utils.smiles_to_graphs_tuple(smiles, tensorizer) return graphs, mols
def _setup_graphs(self): """Setup graphs and smiles if needed.""" tensorizer = featurization.MolTensorizer() smiles = [ 'CO', 'Cc1occc1C(=O)Nc2ccccc2', 'CC(C)=CCCC(C)=CC(=O)', 'c1ccc2c(c1)ccc3c2ccc4c5ccccc5ccc43', 'c1ccsc1', 'c2ccc1scnc1c2', 'Clc1cc(Cl)c(c(Cl)c1)c2c(Cl)cccc2Cl', ] graphs = graph_utils.smiles_to_graphs_tuple(smiles, tensorizer) return graphs, smiles, tensorizer
def _setup_graphs_model(self): """Setup graphs and smiles if needed.""" tensorizer = featurization.MolTensorizer() smiles = ['CO', 'CCC', 'CN1C=NC2=C1C(=O)N(C(=O)N2C)C'] graphs = graph_utils.smiles_to_graphs_tuple(smiles, tensorizer) # Fix seed so that initialization is deterministic. tf.random.set_seed(0) model = experiments.GNN(5, 3, 10, 1, models.BlockType('gcn'), 'relu', templates.TargetType.globals, 3) model(graphs) return graphs, model, tensorizer
def _setup_experiment(self): """Setup graphs and smiles if needed.""" smiles = ['CO', 'CCC', 'CN1C=NC2=C1C(=O)N(C(=O)N2C)C'] n = len(smiles) smiles_to_mol = functools.partial( featurization.smiles_to_mol, infer_hydrogens=True) tensorizer = featurization.MolTensorizer(preprocess_fn=smiles_to_mol) train_index, test_index = np.arange(n - 1), np.arange(n - 1, n) mol_list = [smiles_to_mol(smi) for smi in smiles] x = graph_utils.smiles_to_graphs_tuple(smiles, tensorizer) task = tasks.get_task(tasks.Task.crippen) y = task.get_true_predictions(mol_list) atts = task.get_true_attributions(mol_list) exp = experiments.ExperimentData.from_data_and_splits( x, y, atts, train_index, test_index) model = experiments.GNN(5, 3, 10, 1, models.BlockType.gcn, 'relu', templates.TargetType.globals, 2) model(x) method = techniques.CAM() return exp, model, task, method
def _setup_graphs(self): """Setup graphs and smiles if needed.""" tensorizer = featurization.MolTensorizer() smiles = ['CO', 'CCC', 'CN1C=NC2=C1C(=O)N(C(=O)N2C)C'] return graph_utils.smiles_to_graphs_tuple(smiles, tensorizer)