class_docstr: TCTS Model
  
  Parameters
  ----------
  d_feat : int
      input dimension for each time step
  metric: str
      the evaluation metric used in early stop
  optimizer : str
      optimizer name
  GPU : str
      the GPU ID(s) used for training
class_docstr_tok: ["TCTS","Model","Parameters","--","--","--","--","--","d_feat",":","int","input","dimension","for","each","time","step","metric",":","str","the","evaluation","metric","used","in","early","stop","optimizer",":","str","optimizer","name","GPU",":","str","the","GPU","ID","(","s",")","used","for","training"]
code: def fit(
      self,
      dataset: DatasetH,
      verbose=True,
      save_path=None,
  ):
      df_train, df_valid, df_test = dataset.prepare(
          ["train", "valid", "test"],
          col_set=["feature", "label"],
          data_key=DataHandlerLP.DK_L,
      )
      if df_train.empty or df_valid.empty:
          raise ValueError(
              "Empty data from dataset, please check your dataset config."
          )
  
      x_train, y_train = df_train["feature"], df_train["label"]
      x_valid, y_valid = df_valid["feature"], df_valid["label"]
      x_test, y_test = df_test["feature"], df_test["label"]
  
      if save_path is None:
          save_path = get_or_create_path(save_path)
      best_loss = np.inf
      while best_loss > self.lowest_valid_performance:
          if best_loss < np.inf:
              print("Failed! Start retraining.")
              self.seed = random.randint(0, 1000)  # reset random seed
  
          if self.seed is not None:
              np.random.seed(self.seed)
              torch.manual_seed(self.seed)
  
          best_loss = self.training(
              x_train,
              y_train,
              x_valid,
              y_valid,
              x_test,
              y_test,
              verbose=verbose,
              save_path=save_path,
          )
  
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  import pandas
  import copy
  import random
  from ...utils import get_or_create_path
  from ...log import get_module_logger
  import torch
  import torch.nn
  import torch.optim
  from ...model.base import Model
  from ...data.dataset import DatasetH
  from ...data.dataset.handler import DataHandlerLP
label_desc: Use image node_id 5 for calling the TCTS obj's underlying member method code with example usage: obj.fit(dataset, verbose, save_path) without return types