class_docstr: Session-based Recommendations with Recurrent Neural Networks
  
  Parameters
  ----------
  name: string, default: 'GRU4Rec'
      The name of the recommender model.
  
  layers: list of int, optional, default: [100]
      The number of hidden units in each layer
  
  loss: str, optional, default: 'cross-entropy'
      Select the loss function.
  
  batch_size: int, optional, default: 512
      Batch size
  
  dropout_p_embed: float, optional, default: 0.0
      Dropout ratio for embedding layers
  
  dropout_p_hidden: float, optional, default: 0.0
      Dropout ratio for hidden layers
  
  learning_rate: float, optional, default: 0.05
      Learning rate for the optimizer
  
  momentum: float, optional, default: 0.0
      Momentum for adaptive learning rate
  
  sample_alpha: float, optional, default: 0.5
      Tradeoff factor controls the contribution of negative sample towards final loss
  
  n_sample: int, optional, default: 2048
      Number of negative samples
  
  embedding: int, optional, default: 0
  
  constrained_embedding: bool, optional, default: True
  
  n_epochs: int, optional, default: 10
  
  bpreg: float, optional, default: 1.0
      Regularization coefficient for 'bpr-max' loss.
  
  elu_param: float, optional, default: 0.5
      Elu param for 'bpr-max' loss
  
  logq: float, optional, default: 0,
      LogQ correction  to offset the sampling bias affecting 'cross-entropy' loss.
  
  device: str, optional, default: 'cpu'
      Set to 'cuda' for GPU support.
  
  trainable: boolean, optional, default: True
      When False, the model will not be re-trained, and input of pre-trained parameters are required.
  
  verbose: boolean, optional, default: True
      When True, running logs are displayed.
  
  seed: int, optional, default: None
      Random seed for weight initialization.
  
  References
  ----------
  Hidasi, B., Karatzoglou, A., Baltrunas, L., & Tikk, D. (2015).
  Session-based recommendations with recurrent neural networks.
  arXiv preprint arXiv:1511.06939.
code: def __init__(
      self,
      name="GRU4Rec",
      layers=[100],
      loss="cross-entropy",
      batch_size=512,
      dropout_p_embed=0.0,
      dropout_p_hidden=0.0,
      learning_rate=0.05,
      momentum=0.0,
      sample_alpha=0.5,
      n_sample=2048,
      embedding=0,
      constrained_embedding=True,
      n_epochs=10,
      bpreg=1.0,
      elu_param=0.5,
      logq=0.0,
      device="cpu",
      trainable=True,
      verbose=False,
      seed=None,
  ):
      super().__init__(name, trainable=trainable, verbose=verbose)
      self.layers = layers
      self.loss = loss
      self.batch_size = batch_size
      self.dropout_p_embed = dropout_p_embed
      self.dropout_p_hidden = dropout_p_hidden
      self.learning_rate = learning_rate
      self.momentum = momentum
      self.sample_alpha = sample_alpha
      self.n_sample = n_sample
      self.embedding = (
          self.layers[0] if embedding == "layersize" else embedding
      )
      self.constrained_embedding = constrained_embedding
      self.n_epochs = n_epochs
      self.bpreg = bpreg
      self.elu_param = elu_param
      self.logq = logq
      self.device = device
      self.seed = seed
      self.rng = get_rng(seed)
  
file_path: cornac/cornac/models/gru4rec/recom_gru4rec.py
imports: import numpy
  from tqdm.auto import trange
  from collections import Counter
  from cornac.models.recommender import NextItemRecommender
  from ...utils import get_rng
label_desc: Use image node_id 1 to create a new GRU4Rec object from inherited base classes: NextItemRecommender with example: obj = GRU4Rec(name, layers, loss, batch_size, dropout_p_embed, dropout_p_hidden, learning_rate, momentum, sample_alpha, n_sample, embedding, constrained_embedding, n_epochs, bpreg, elu_param, logq, device, trainable, verbose, seed)