class_docstr: PyTorch ``Dataset`` for explicit user-item interactions data.
  
  If ``mat`` is provided, the ``Interactions`` instance will act as a wrapper for a sparse matrix
  in COOrdinate format, typically looking like:
  
  * Users comprising the rows
  
  * Items comprising the columns
  
  * Ratings given by that user for that item comprising the elements of the matrix
  
  ``Interactions`` can be instantiated instead by passing in single arrays with corresponding
  user_ids, item_ids, and ratings values with the same functionality as a matrix. Note that with
  this approach, the number of users and items will be the maximum values in those two columns,
  respectively, and it is expected that all integers between 0 and the maximum ID should appear
  somewhere in the user or item ID data.
  
  Unlike in ``Interactions``, there is no need for negative sampling for explicit data. Each
  ``__getitem__`` call will thus return a single, non-nested tuple containing user IDs, item IDs,
  and ratings. This nested vs. non-nested structure is key for the model to determine where it
  should be implicit or explicit. Use the table below for reference:
  
  .. list-table::
      :header-rows: 1
  
      * - ``__getitem__`` Format
        - Expected Meaning
        - Model Type
      * - ``((X, Y), Z)``
        - ``((user IDs, item IDs), negative item IDs)``
        - **Implicit**
      * - ``(X, Y, Z)``
        - ``(user IDs, item IDs, ratings)``
        - **Explicit**
  
  Parameters
  -------------
  mat: scipy.sparse.coo_matrix or numpy.array, 2-dimensional
      Interactions matrix, which, if provided, will be used instead of ``users``, ``items``, and
      ``ratings`` arguments
  users: Iterable[int], 1-d
      Array of user IDs, starting at 0
  items: Iterable[int], 1-d
      Array of corresponding item IDs to ``users``, starting at 0
  ratings: Iterable[int], 1-d
      Array of corresponding ratings to both ``users`` and ``items``. If ``None``, will default to
      each user in ``user`` interacting with an item with a rating value of 1
  allow_missing_ids: bool
      If ``False``, will check that both ``users`` and ``items`` contain each integer from 0 to
      the maximum value in the array. This check only applies when initializing an
      ``ExplicitInteractions`` instance using 1-dimensional arrays ``users`` and ``items``
  remove_duplicate_user_item_pairs: bool
      Will check for and remove any duplicate user, item ID pairs from the
      ``ExplicitInteractions`` matrix during initialization. Note that this will create a second
      sparse matrix held in memory to efficiently check, which could cause memory concerns for
      larger data. If you are sure that there are no duplicated, user, item ID pairs, set to
      ``False``
  num_users: int
      Number of users in the dataset. If ``num_users == 'infer'``, this will be set to the
      ``mat.shape[0]`` or ``max(users) + 1``, depending on the input
  num_items: int
      Number of items in the dataset. If ``num_items == 'infer'``, this will be set to the
      ``mat.shape[1]`` or ``max(items) + 1``, depending on the input
class_docstr_tok: ["PyTorch","``","Dataset","``","for","explicit","user-item","interactions","data",".","If","``","mat","``","is","provided",",","the","``","Interactions","``","instance","will","act","as","a","wrapper","for","a","sparse","matrix","in","COOrdinate","format",",","typically","looking","like",":","*","Users","comprising","the","rows","*","Items","comprising","the","columns","*","Ratings","given","by","that","user","for","that","item","comprising","the","elements","of","the","matrix","``","Interactions","``","can","be","instantiated","instead","by","passing","in","single","arrays","with","corresponding","user_ids",",","item_ids",",","and","ratings","values","with","the","same","functionality","as","a","matrix",".","Note","that","with","this","approach",",","the","number","of","users","and","items","will","be","the","maximum","values","in","those","two","columns",",","respectively",",","and","it","is","expected","that","all","integers","between","0","and","the","maximum","ID","should","appear","somewhere","in","the","user","or","item","ID","data",".","Unlike","in","``","Interactions","``",",","there","is","no","need","for","negative","sampling","for","explicit","data",".","Each","``","__getitem__","``","call","will","thus","return","a","single",",","non-nested","tuple","containing","user","IDs",",","item","IDs",",","and","ratings",".","This","nested","vs.","non-nested","structure","is","key","for","the","model","to","determine","where","it","should","be","implicit","or","explicit",".","Use","the","table","below","for","reference",":","..","list-table",":",":",":","header-rows",":","1","*","-","``","__getitem__","``","Format","-","Expected","Meaning","-","Model","Type","*","-","``","(","(","X",",","Y",")",",","Z",")","``","-","``","(","(","user","IDs",",","item","IDs",")",",","negative","item","IDs",")","``","-","*","*","Implicit","*","*","*","-","``","(","X",",","Y",",","Z",")","``","-","``","(","user","IDs",",","item","IDs",",","ratings",")","``","-","*","*","Explicit","*","*","Parameters","--","--","--","--","--","--","-","mat",":","scipy.sparse.coo_matrix","or","numpy.array",",","2-dimensional","Interactions","matrix",",","which",",","if","provided",",","will","be","used","instead","of","``","users","``",",","``","items","``",",","and","``","ratings","``","arguments","users",":","Iterable","[","int","]",",","1-d","Array","of","user","IDs",",","starting","at","0","items",":","Iterable","[","int","]",",","1-d","Array","of","corresponding","item","IDs","to","``","users","``",",","starting","at","0","ratings",":","Iterable","[","int","]",",","1-d","Array","of","corresponding","ratings","to","both","``","users","``","and","``","items","``",".","If","``","None","``",",","will","default","to","each","user","in","``","user","``","interacting","with","an","item","with","a","rating","value","of","1","allow_missing_ids",":","bool","If","``","False","``",",","will","check","that","both","``","users","``","and","``","items","``","contain","each","integer","from","0","to","the","maximum","value","in","the","array",".","This","check","only","applies","when","initializing","an","``","ExplicitInteractions","``","instance","using","1-dimensional","arrays","``","users","``","and","``","items","``","remove_duplicate_user_item_pairs",":","bool","Will","check","for","and","remove","any","duplicate","user",",","item","ID","pairs","from","the","``","ExplicitInteractions","``","matrix","during","initialization",".","Note","that","this","will","create","a","second","sparse","matrix","held","in","memory","to","efficiently","check",",","which","could","cause","memory","concerns","for","larger","data",".","If","you","are","sure","that","there","are","no","duplicated",",","user",",","item","ID","pairs",",","set","to","``","False","``","num_users",":","int","Number","of","users","in","the","dataset",".","If","``","num_users","==","'infer","'","``",",","this","will","be","set","to","the","``","mat.shape","[","0","]","``","or","``","max","(","users",")","+","1","``",",","depending","on","the","input","num_items",":","int","Number","of","items","in","the","dataset",".","If","``","num_items","==","'infer","'","``",",","this","will","be","set","to","the","``","mat.shape","[","1","]","``","or","``","max","(","items",")","+","1","``",",","depending","on","the","input"]
docstr: String representation of ``ExplicitInteractions`` class.
docstr_tok: ["String","representation","of","``","ExplicitInteractions","``","class","."]
code: def __repr__(self) -> str:
      """String representation of ``ExplicitInteractions`` class."""
      return (
          textwrap.dedent(
              f"""
              ExplicitInteractions object with {self.num_interactions} interactions between
              {self.num_users} users and {self.num_items} items, with minimum rating of
              {self.min_rating} and maximum rating of {self.max_rating}.
              """
          )
          .replace("\n", " ")
          .strip()
      )
  
imports: from abc import ABCMeta, abstractmethod
  import collections
  import random
  import textwrap
  from typing import Any, Iterable, List, Optional, Tuple, Union
  import warnings
  import numpy
  import pandas
  from scipy.sparse import coo_matrix, dok_matrix
  import torch
  from tqdm.auto import tqdm
  import collie
label_desc: Use image node_id 3 for calling the ExplicitInteractions obj's underlying member method code with example usage: obj.__repr__() and returns: textwrap