Commit 8b19f9ae authored by Milosz Grabski's avatar Milosz Grabski
Browse files

removed returns from molgan, test clean-up

parent 0b9a0cb5
Loading
Loading
Loading
Loading
+5 −15
Original line number Diff line number Diff line
@@ -118,12 +118,7 @@ class BasicMolGANModel(WGAN):
    Take noise data as an input and processes it through number of
    dense and dropout layers. Then data is converted into two forms
    one used for training and other for generation of compounds.

    Returns
    -------
    keras.Model
        Returns generator model.
        There are four output of this model:
    The model has four outputs:
      1. edges logits used during training
      2. nodes logits used during training
      3. edges logits used for compound generation
@@ -190,11 +185,6 @@ class BasicMolGANModel(WGAN):
    The input vectors need to be in one-hot encoding format.
    Use MolGAN featurizer for that purpose. It will be simplified
    in the future release.

    Returns
    -------
    keras.Model
        Returns disctriminator model
    """
    adjacency_tensor = layers.Input(
        shape=(self.vertices, self.vertices, self.edges))
+4 −1
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@ from deepchem.feat.molecule_featurizers import MolGanFeaturizer
from deepchem.models import BasicMolGANModel as MolGAN
from deepchem.models.optimizers import ExponentialDecay
from tensorflow import one_hot
from tensorflow.errors import InternalError
from tensorflow.keras.backend import clear_session as keras_clear_session


@@ -115,12 +114,16 @@ class test_molgan_model(unittest.TestCase):

      # generate sample
      g = gan.predict_gan_generator(1000)

      # check how many valid molecules were created and add to list
      generated_molecules = feat.defeaturize(g)
      valid_molecules_count = len(
          list(filter(lambda x: x is not None, generated_molecules)))
      if valid_molecules_count:
        valid_attempts = valid_attempts + 1

    # finally test if there was at least one valid training session
    # as the model structure improves this should become more and more strict
    assert valid_attempts > 0