code: def build_sequence_model(hyperparameters, train, random_state):
      h = hyperparameters
  
      set_seed(42, CUDA)
  
      if h["compression_ratio"] < 1.0:
          item_embeddings = BloomEmbedding(
              train.num_items,
              h["embedding_dim"],
              compression_ratio=h["compression_ratio"],
              num_hash_functions=4,
              padding_idx=0,
          )
      else:
          item_embeddings = ScaledEmbedding(
              train.num_items, h["embedding_dim"], padding_idx=0
          )
  
      network = LSTMNet(
          train.num_items,
          h["embedding_dim"],
          item_embedding_layer=item_embeddings,
      )
  
      model = ImplicitSequenceModel(
          loss=h["loss"],
          n_iter=h["n_iter"],
          batch_size=h["batch_size"],
          learning_rate=h["learning_rate"],
          embedding_dim=h["embedding_dim"],
          l2=h["l2"],
          representation=network,
          use_cuda=CUDA,
          random_state=np.random.RandomState(42),
      )
  
      return model
  
imports: import argparse
  import hashlib
  import json
  import os
  import shutil
  import time
  import numpy
  from sklearn.model_selection import ParameterSampler
  from spotlight.datasets.movielens import get_movielens_dataset
  from spotlight.datasets.amazon import get_amazon_dataset
  from spotlight.cross_validation import random_train_test_split, user_based_train_test_split
  from spotlight.sequence.implicit import ImplicitSequenceModel
  from spotlight.factorization.implicit import ImplicitFactorizationModel
  from spotlight.sequence.representations import LSTMNet
  from spotlight.factorization.representations import BilinearNet
  from spotlight.layers import BloomEmbedding, ScaledEmbedding
  from spotlight.evaluation import mrr_score, sequence_mrr_score
  from spotlight.torch_utils import set_seed
label_desc: Use image node_id 3 for calling a global function with example usage: build_sequence_model(hyperparameters, train, random_state) and returns: model