Unverified Commit 8e78a054 authored by Bharath Ramsundar's avatar Bharath Ramsundar Committed by GitHub
Browse files

Merge pull request #2151 from deepchem/gcsave

Adding first saving/reload tests
parents ae12a7eb f86003a4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -344,8 +344,8 @@ class MultitaskRegressor(KerasModel):
class MultitaskFitTransformRegressor(MultitaskRegressor):
  """Implements a MultitaskRegressor that performs on-the-fly transformation during fit/predict.

  Example:

  Examples
  --------
  >>> n_samples = 10
  >>> n_features = 3
  >>> n_tasks = 1
+6 −4
Original line number Diff line number Diff line
@@ -561,7 +561,9 @@ class KerasModel(Model):
      returns the values of the uncertainty outputs.
    other_output_types: list, optional
      Provides a list of other output_types (strings) to predict from model.
    Returns:

    Returns
    -------
    a NumPy array of the model produces a single output, or a list of arrays
    if it produces multiple outputs
    """
@@ -786,7 +788,7 @@ class KerasModel(Model):
    if it produces multiple outputs
    """
    generator = self.default_generator(
        dataset, mode='predict', pad_batches=False)
        dataset, mode='predict', deterministic=True, pad_batches=False)
    return self.predict_on_generator(
        generator,
        transformers=transformers,
+3 −3
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ def test_skewed_classification_overfit():


def test_skewed_missing_classification_overfit():
  """TG, skewed data, few actives
  """MultitaskClassifier, skewed data, few actives

  Test MultitaskClassifier overfit 0/1 datasets with missing data and few
  actives. This is intended to be as close to singletask MUV datasets as
@@ -377,8 +377,8 @@ def test_multitask_classification_overfit():
  assert scores[classification_metric.name] > .9


def test_tf_robust_multitask_classification_overfit():
  """Test tf robust multitask overfits tiny data."""
def test_robust_multitask_classification_overfit():
  """Test robust multitask overfits tiny data."""
  n_tasks = 10
  n_samples = 10
  n_features = 3
+913 −30

File changed.

Preview size limit exceeded, changes collapsed.

+19 −0
Original line number Diff line number Diff line
@@ -63,6 +63,25 @@ that break them may sometimes slip through and get merged into the repository.
We still try to run them regularly, so hopefully the problem will be discovered
fairly soon.

Testing Machine Learning Models
-------------------------------

Testing the correctness of a machine learning model can be quite
tricky to do in practice. When adding a new machine learning model to
DeepChem, you should add at least a few basic types of unit tests:

- Overfitting test: Create a small synthetic dataset and test that
your model can learn this datasest with high accuracy. For regression
and classification task, this should correspond to low training error
on the dataset. For generative tasks, this should correspond to low
training loss on the dataset.
- Reloading test: Check that a trained model can be saved to disk and
reloaded correctly. This should involve checking that predictions from
the saved and reloaded models matching exactly.

Note that unit tests are not sufficient to gauge the real performance
of a model. You should benchmark your model on larger datasets as well
and report your benchmarking tests in the PR comments.

Type Annotations
----------------
+20 −20

File changed.

Contains only whitespace changes.

Loading