def test(): (traindata_SMILES, trainlabels), valdata, testdata = utils.load_delaney() array_rep = utils.array_rep_from_smiles(traindata_SMILES[:2000]) for degree in range(6): atom_neighbors_list = array_rep[('atom_neighbors', degree)] print 'degree',degree if len(atom_neighbors_list): print atom_neighbors_list.shape, atom_neighbors_list.min(), atom_neighbors_list.max() test__main(array_rep)
from __future__ import division, print_function, absolute_import from keras.layers import Input, merge, Dense from keras import models import utils from NGF.preprocessing import tensorise_smiles, tensorise_smiles_mp from NGF.layers import NeuralGraphHidden, NeuralGraphOutput from NGF.models import build_graph_conv_model from NGF.sparse import GraphTensor, EpochIterator # ============================================================================== # ================================ Load the data =============================== # ============================================================================== print("{:=^100}".format(' Data preprocessing ')) data, labels = utils.load_delaney() # Tensorise data X_atoms, X_bonds, X_edges = tensorise_smiles_mp(data) print('Atoms:', X_atoms.shape) print('Bonds:', X_bonds.shape) print('Edges:', X_edges.shape) # Load sizes from data shape num_molecules = X_atoms.shape[0] max_atoms = X_atoms.shape[1] max_degree = X_bonds.shape[2] num_atom_features = X_atoms.shape[-1] num_bond_features = X_bonds.shape[-1] # ==============================================================================