Commit c2a674b7 authored by VIGNESHinZONE's avatar VIGNESHinZONE
Browse files

fixing test imports

parent 0e789243
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,13 +5,13 @@ import numpy as np

import deepchem as dc
from deepchem.feat import MolGraphConvFeaturizer
from deepchem.models import AttentiveFPModel
from deepchem.models.tests.test_graph_models import get_dataset

try:
  import dgl
  import dgllife
  import torch
  from deepchem.models import AttentiveFPModel
  has_torch_and_dgl = True
except:
  has_torch_and_dgl = False
+1 −1
Original line number Diff line number Diff line
@@ -7,11 +7,11 @@ import numpy as np
from deepchem.feat import CGCNNFeaturizer
from deepchem.molnet import load_perovskite, load_mp_metallicity
from deepchem.metrics import Metric, mae_score, roc_auc_score
from deepchem.models import CGCNNModel

try:
  import dgl  # noqa
  import torch  # noqa
  from deepchem.models import CGCNNModel
  has_pytorch_and_dgl = True
except:
  has_pytorch_and_dgl = False
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ import tempfile
import numpy as np

import deepchem as dc
from deepchem.feat import MolGraphConvFeaturizer
from deepchem.models import GATModel
from deepchem.models.tests.test_graph_models import get_dataset

@@ -12,6 +11,7 @@ try:
  import dgl
  import dgllife
  import torch
  from deepchem.feat import MolGraphConvFeaturizer
  has_torch_and_dgl = True
except:
  has_torch_and_dgl = False
+23 −3
Original line number Diff line number Diff line
@@ -3,16 +3,22 @@ Tests to make sure deepchem models can fit models on easy datasets.
"""

import tempfile

import unittest
import numpy as np
import xgboost
import lightgbm
from sklearn.datasets import load_diabetes, load_digits
from sklearn.model_selection import train_test_split
try:
  import xgboost
  import lightgbm
  has_xgboost_and_lightgbm = True
except:
  has_xgboost_and_lightgbm = False

import deepchem as dc


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_singletask_regression_with_xgboost():
  np.random.seed(123)

@@ -41,6 +47,8 @@ def test_singletask_regression_with_xgboost():
  assert scores[regression_metric.name] < 55


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_singletask_regression_with_lightgbm():
  np.random.seed(123)

@@ -69,6 +77,8 @@ def test_singletask_regression_with_lightgbm():
  assert scores[regression_metric.name] < 55


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_multitask_regression_with_xgboost():
  np.random.seed(123)

@@ -104,6 +114,8 @@ def test_multitask_regression_with_xgboost():
  assert score < 55


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_multitask_regression_with_lightgbm():
  np.random.seed(123)

@@ -139,6 +151,8 @@ def test_multitask_regression_with_lightgbm():
  assert score < 55


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_classification_with_xgboost():
  """Test that sklearn models can learn on simple classification datasets."""
  np.random.seed(123)
@@ -167,6 +181,8 @@ def test_classification_with_xgboost():
  assert scores[classification_metric.name] > .9


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_classification_with_lightgbm():
  """Test that sklearn models can learn on simple classification datasets."""
  np.random.seed(123)
@@ -195,6 +211,8 @@ def test_classification_with_lightgbm():
  assert scores[classification_metric.name] > .9


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_reload_with_xgboost():
  np.random.seed(123)

@@ -231,6 +249,8 @@ def test_reload_with_xgboost():
  assert scores[regression_metric.name] < 55


@unittest.skipIf(not has_xgboost_and_lightgbm,
                 'xgboost or lightgbm are not installed')
def test_reload_with_lightgbm():
  np.random.seed(123)

+1 −1
Original line number Diff line number Diff line
@@ -5,13 +5,13 @@ import numpy as np

import deepchem as dc
from deepchem.feat import MolGraphConvFeaturizer
from deepchem.models import GCNModel
from deepchem.models.tests.test_graph_models import get_dataset

try:
  import dgl
  import dgllife
  import torch
  from deepchem.models import GCNModel
  has_torch_and_dgl = True
except:
  has_torch_and_dgl = False
Loading