class_docstr: ALSTM 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 : int
      the GPU ID used for training
class_docstr_tok: ["ALSTM","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",":","int","the","GPU","ID","used","for","training"]
code: def train_epoch(self, x_train, y_train):
      x_train_values = x_train.values
      y_train_values = np.squeeze(y_train.values)
  
      self.ALSTM_model.train()
  
      indices = np.arange(len(x_train_values))
      np.random.shuffle(indices)
  
      for i in range(len(indices))[:: self.batch_size]:
          if len(indices) - i < self.batch_size:
              break
  
          feature = (
              torch.from_numpy(
                  x_train_values[indices[i : i + self.batch_size]]
              )
              .float()
              .to(self.device)
          )
          label = (
              torch.from_numpy(
                  y_train_values[indices[i : i + self.batch_size]]
              )
              .float()
              .to(self.device)
          )
  
          pred = self.ALSTM_model(feature)
          loss = self.loss_fn(pred, label)
  
          self.train_optimizer.zero_grad()
          loss.backward()
          torch.nn.utils.clip_grad_value_(
              self.ALSTM_model.parameters(), 3.0
          )
          self.train_optimizer.step()
  
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  import pandas
  from typing import Text, Union
  import copy
  from ...utils import get_or_create_path
  from ...log import get_module_logger
  import torch
  import torch.nn
  import torch.optim
  from .pytorch_utils import count_parameters
  from ...model.base import Model
  from ...data.dataset import DatasetH
  from ...data.dataset.handler import DataHandlerLP
label_desc: Use image node_id 6 for calling the ALSTM obj's underlying member method code with example usage: obj.train_epoch(x_train, y_train) without return types