Commit 024e587a authored by miaecle's avatar miaecle
Browse files

fixing test failure and bug

parent 0cea9587
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ def run_benchmark_low_data(datasets,
          output_line = [dataset, str(split), mode, 'valid', i]
          for task in valid_score[i][0]:
            output_line.extend(
                [task.valid_score[i][0][task], valid_score[i][1][task]])
                [task, valid_score[i][0][task], valid_score[i][1][task]])
          output_line.extend(
              ['time_for_running', time_finish_fitting - time_start_fitting])
          writer.writerow(output_line)
+9 −8
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import unittest
import numpy as np
import pandas as pd
import deepchem as dc
import tempfile
import csv


@@ -27,7 +28,7 @@ class TestMolnet(unittest.TestCase):
    datasets = ['delaney']
    model = 'graphconvreg'
    split = 'random'
    out_path = self.current_dir
    out_path = tempfile.mkdtemp()
    dc.molnet.run_benchmark(
        datasets, str(model), split=split, out_path=out_path)
    with open(os.path.join(out_path, 'results.csv'), 'r') as f:
@@ -42,26 +43,26 @@ class TestMolnet(unittest.TestCase):
  def test_qm7_multitask(self):
    """Tests molnet benchmarking on qm7 with multitask network."""
    datasets = ['qm7']
    model = 'tf_regression'
    model = 'tf_regressioni_ft'
    split = 'random'
    out_path = self.current_dir
    out_path = tempfile.mkdtemp()
    dc.molnet.run_benchmark(
        datasets, str(model), split=split, out_path=out_path)
    with open(os.path.join(out_path, 'results.csv'), 'r') as f:
      reader = csv.reader(f)
      for lastrow in reader:
        pass
      assert lastrow[-4] == model + '_ft'
      assert lastrow[-4] == model
      assert lastrow[-5] == 'valid'
      assert float(lastrow[-3]) > 0.95
    os.remove(os.path.join(out_path, 'results.csv'))

  def test_tox21_multitask(self):
    """Tests molnet benchmarking on tox21 with multitask network."""
    datasets = ['tox21']
  def test_clintox_multitask(self):
    """Tests molnet benchmarking on clintox with multitask network."""
    datasets = ['clintox']
    model = 'tf'
    split = 'random'
    out_path = self.current_dir
    out_path = tempfile.mkdtemp()
    dc.molnet.run_benchmark(
        datasets, str(model), split=split, out_path=out_path, test=True)
    with open(os.path.join(out_path, 'results.csv'), 'r') as f: