code: def gen_kaggle(
      KAGGLE_tasks,
      train_dir,
      valid_dir,
      test_dir,
      data_dir,
      shard_size=2000,
  ):
      """Load KAGGLE datasets. Does not do train/test split"""
      # TIMING
      time1 = time.time()
      # TIMING
      # Set some global variables up top
      train_files = os.path.join(
          data_dir, "KAGGLE_training_disguised_combined_full.csv.gz"
      )
      valid_files = os.path.join(
          data_dir, "KAGGLE_test1_disguised_combined_full.csv.gz"
      )
      test_files = os.path.join(
          data_dir, "KAGGLE_test2_disguised_combined_full.csv.gz"
      )
      if not os.path.exists(train_files):
          deepchem.utils.data_utils.download_url(
              "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/KAGGLE_training_disguised_combined_full.csv.gz",
              dest_dir=data_dir,
          )
          deepchem.utils.data_utils.download_url(
              "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/KAGGLE_test1_disguised_combined_full.csv.gz",
              dest_dir=data_dir,
          )
          deepchem.utils.data_utils.download_url(
              "https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/KAGGLE_test2_disguised_combined_full.csv.gz",
              dest_dir=data_dir,
          )
  
      # Featurize KAGGLE dataset
      logger.info("About to featurize KAGGLE dataset.")
      featurizer = deepchem.feat.UserDefinedFeaturizer(
          merck_descriptors
      )
  
      loader = deepchem.data.UserCSVLoader(
          tasks=KAGGLE_tasks, id_field="Molecule", featurizer=featurizer
      )
  
      logger.info("Featurizing train datasets")
      train_dataset = loader.featurize(
          train_files, shard_size=shard_size
      )
  
      logger.info("Featurizing valid datasets")
      valid_dataset = loader.featurize(
          valid_files, shard_size=shard_size
      )
  
      logger.info("Featurizing test datasets")
      test_dataset = loader.featurize(test_files, shard_size=shard_size)
  
      logger.info("Remove missing entries from datasets.")
      remove_missing_entries(train_dataset)
      remove_missing_entries(valid_dataset)
      remove_missing_entries(test_dataset)
  
      logger.info("Shuffling order of train dataset.")
      train_dataset.sparse_shuffle()
  
      logger.info("Transforming datasets with transformers.")
      transformers = get_transformers(train_dataset)
  
      for transformer in transformers:
          logger.info(
              "Performing transformations with %s"
              % transformer.__class__.__name__
          )
          logger.info("Transforming datasets")
          train_dataset = transformer.transform(train_dataset)
          valid_dataset = transformer.transform(valid_dataset)
          test_dataset = transformer.transform(test_dataset)
  
      logger.info("Moving directories")
      train_dataset.move(train_dir)
      valid_dataset.move(valid_dir)
      test_dataset.move(test_dir)
  
      # TIMING
      time2 = time.time()
      logger.info(
          "TIMING: KAGGLE fitting took %0.3f s" % (time2 - time1)
      )
      # TIMING
  
      return train_dataset, valid_dataset, test_dataset
  
file_path: deepchem/deepchem/molnet/load_function/kaggle_datasets.py
imports: import os
  import logging
  import time
  import deepchem
  from deepchem.molnet.load_function.kaggle_features import merck_descriptors
  from deepchem.utils import remove_missing_entries
label_desc: Use image node_id 2 for calling a global function with example usage: gen_kaggle(KAGGLE_tasks, train_dir, valid_dir, test_dir, data_dir, shard_size) and returns: train_dataset,  valid_dataset,  test_dataset