class_docstr: Base dot model for collaborative filtering.
class_docstr_tok: ["Base","dot","model","for","collaborative","filtering","."]
docstr: Fetch item or user (based on `is_item`) for all in `arr`
docstr_tok: ["Fetch","item","or","user","(","based","on","`","is_item","`",")","for","all","in","`","arr","`"]
code: def _get_idx(self, arr, is_item=True):
      "Fetch item or user (based on `is_item`) for all in `arr`"
      assert hasattr(
          self, "classes"
      ), "Build your model with `EmbeddingDotBias.from_classes` to use this functionality."
      classes = (
          self.classes[self.item]
          if is_item
          else self.classes[self.user]
      )
      c2i = {v: k for k, v in enumerate(classes)}
      try:
          return tensor([c2i[o] for o in arr])
      except KeyError as e:
          message = f"You're trying to access {'an item' if is_item else 'a user'} that isn't in the training data. If it was in your original data, it may have been split such that it's only in the validation set now."
          raise modify_exception(e, message, replace=True)
  
file_path: fastai/fastai/collab.py
imports: from __future__ import annotations
  from .tabular.all import *
label_desc: Use image node_id 4 for calling the EmbeddingDotBias obj's underlying member method code with example usage: obj._get_idx(arr, is_item) and returns: tensor