class_docstr: Model for sequential recommendations using implicit feedback.
  
  Parameters
  ----------
  
  loss: string, optional
      The loss function for approximating a softmax with negative sampling.
      One of 'pointwise', 'bpr', 'hinge', 'adaptive_hinge', corresponding
      to losses from :class:`spotlight.losses`.
  representation: string or instance of :class:`spotlight.sequence.representations`, optional
      Sequence representation to use. If string, it must be one
      of 'pooling', 'cnn', 'lstm', 'mixture'; otherwise must be one of the
      representations from :class:`spotlight.sequence.representations`
  embedding_dim: int, optional
      Number of embedding dimensions to use for representing items.
      Overridden if representation is an instance of a representation class.
  n_iter: int, optional
      Number of iterations to run.
  batch_size: int, optional
      Minibatch size.
  l2: float, optional
      L2 loss penalty.
  learning_rate: float, optional
      Initial learning rate.
  optimizer_func: function, optional
      Function that takes in module parameters as the first argument and
      returns an instance of a PyTorch optimizer. Overrides l2 and learning
      rate if supplied. If no optimizer supplied, then use ADAM by default.
  use_cuda: boolean, optional
      Run the model on a GPU.
  sparse: boolean, optional
      Use sparse gradients for embedding layers.
  random_state: instance of numpy.random.RandomState, optional
      Random state to use when fitting.
  num_negative_samples: int, optional
      Number of negative samples to generate for adaptive hinge loss.
  
  Notes
  -----
  
  During fitting, the model computes the loss for each timestep of the
  supplied sequence. For example, suppose the following sequences are
  passed to the ``fit`` function:
  
  .. code-block:: python
  
     [[1, 2, 3, 4, 5],
      [0, 0, 7, 1, 4]]
  
  
  In this case, the loss for the first example will be the mean loss
  of trying to predict ``2`` from ``[1]``, ``3`` from ``[1, 2]``,
  ``4`` from ``[1, 2, 3]`` and so on. This means that explicit padding
  of all subsequences is not necessary (although it is possible by using
  the ``step_size`` parameter of
  :func:`spotlight.interactions.Interactions.to_sequence`.
class_docstr_tok: ["Model","for","sequential","recommendations","using","implicit","feedback",".","Parameters","--","--","--","--","--","loss",":","string",",","optional","The","loss","function","for","approximating","a","softmax","with","negative","sampling",".","One","of","'pointwise","'",",","'bpr","'",",","'hinge","'",",","'adaptive_hinge","'",",","corresponding","to","losses","from",":","class",":","`","spotlight.losses","`",".","representation",":","string","or","instance","of",":","class",":","`","spotlight.sequence.representations","`",",","optional","Sequence","representation","to","use",".","If","string",",","it","must","be","one","of","'pooling","'",",","'cnn","'",",","'lstm","'",",","'mixture","'",";","otherwise","must","be","one","of","the","representations","from",":","class",":","`","spotlight.sequence.representations","`","embedding_dim",":","int",",","optional","Number","of","embedding","dimensions","to","use","for","representing","items",".","Overridden","if","representation","is","an","instance","of","a","representation","class",".","n_iter",":","int",",","optional","Number","of","iterations","to","run",".","batch_size",":","int",",","optional","Minibatch","size",".","l2",":","float",",","optional","L2","loss","penalty",".","learning_rate",":","float",",","optional","Initial","learning","rate",".","optimizer_func",":","function",",","optional","Function","that","takes","in","module","parameters","as","the","first","argument","and","returns","an","instance","of","a","PyTorch","optimizer",".","Overrides","l2","and","learning","rate","if","supplied",".","If","no","optimizer","supplied",",","then","use","ADAM","by","default",".","use_cuda",":","boolean",",","optional","Run","the","model","on","a","GPU",".","sparse",":","boolean",",","optional","Use","sparse","gradients","for","embedding","layers",".","random_state",":","instance","of","numpy.random.RandomState",",","optional","Random","state","to","use","when","fitting",".","num_negative_samples",":","int",",","optional","Number","of","negative","samples","to","generate","for","adaptive","hinge","loss",".","Notes","--","--","-","During","fitting",",","the","model","computes","the","loss","for","each","timestep","of","the","supplied","sequence",".","For","example",",","suppose","the","following","sequences","are","passed","to","the","``","fit","``","function",":","..","code-block",":",":","python","[","[","1",",","2",",","3",",","4",",","5","]",",","[","0",",","0",",","7",",","1",",","4","]","]","In","this","case",",","the","loss","for","the","first","example","will","be","the","mean","loss","of","trying","to","predict","``","2","``","from","``","[","1","]","``",",","``","3","``","from","``","[","1",",","2","]","``",",","``","4","``","from","``","[","1",",","2",",","3","]","``","and","so","on",".","This","means","that","explicit","padding","of","all","subsequences","is","not","necessary","(","although","it","is","possible","by","using","the","``","step_size","``","parameter","of",":","func",":","`","spotlight.interactions.Interactions.to_sequence","`","."]
code: def _check_input(self, item_ids):
      if isinstance(item_ids, int):
          item_id_max = item_ids
      else:
          item_id_max = item_ids.max()
  
      if item_id_max >= self._num_items:
          raise ValueError(
              "Maximum item id greater "
              "than number of items in model."
          )
  
file_path: spotlight/spotlight/sequence/implicit.py
imports: import numpy
  import torch
  import torch.optim
  from spotlight.helpers import _repr_model
  from spotlight.losses import adaptive_hinge_loss, bpr_loss, hinge_loss, pointwise_loss
  from spotlight.sequence.representations import PADDING_IDX, CNNNet, LSTMNet, MixtureLSTMNet, PoolNet
  from spotlight.sampling import sample_items
  from spotlight.torch_utils import cpu, gpu, minibatch, set_seed, shuffle
label_desc: Use image node_id 5 for calling the ImplicitSequenceModel obj's underlying member method code with example usage: obj._check_input(item_ids) without return types