class_docstr: A SupervisedDataset whose labelled pairs `(x, y)` consist of m-ary combinations
  `x ∈ Z^{m}` of elements from a ground set `Z = (z_1, ...)` and ranking vectors
  `y {0, ..., m - 1}^{m}` with properties:
  
      a) Ranks start at zero, i.e. min(y) = 0.
      b) Sorted ranks are contiguous unless one or more ties are present.
      c) `k` ranks are skipped after a `k`-way tie.
  
  Example:
  
  .. code-block:: python
  
      X = SliceContainer(
          values=torch.rand(16, 2),
          indices=torch.stack([torch.randperm(16)[:3] for _ in range(8)]),
          event_shape=torch.Size([3 * 2]),
      )
      Y = DenseContainer(
          torch.stack([torch.randperm(3) for _ in range(8)]),
          event_shape=torch.Size([3])
      )
      feature_names = ["item_0", "item_1"]
      outcome_names = ["ranking outcome"]
      dataset = RankingDataset(
          X=X,
          Y=Y,
          feature_names=feature_names,
          outcome_names=outcome_names,
      )
code: def _validate(self) -> None:
      super()._validate(
          validate_feature_names=False, validate_outcome_names=False
      )
      if len(self.feature_names) != self._X.values.shape[-1]:
          raise ValueError(
              "The `values` field of `X` must have the same number of columns as "
              "the number of features in `feature_names`."
          )
  
      Y = self.Y
      arity = self._X.indices.shape[-1]
      if Y.min() < 0 or Y.max() >= arity:
          raise ValueError(
              "Invalid ranking(s): out-of-bounds ranks detected."
          )
  
      # Ensure that rankings are well-defined
      Y_sort = Y.sort(descending=False, dim=-1).values
      y_incr = ones([], dtype=long)
      y_prev = None
      for i, y in enumerate(Y_sort.unbind(dim=-1)):
          if i == 0:
              if (y != 0).any():
                  raise ValueError(
                      "Invalid ranking(s): missing zero-th rank."
                  )
              y_prev = y
              continue
  
          y_diff = y - y_prev
          y_prev = y
  
          # Either a tie or next ranking when accounting for previous ties
          if not ((y_diff == 0) | (y_diff == y_incr)).all():
              raise ValueError(
                  "Invalid ranking(s): ranks not skipped after ties."
              )
  
          # Same as: torch.where(y_diff == 0, y_incr + 1, 1)
          y_incr = y_incr - y_diff + 1
  
imports: from __future__ import annotations
  import collections
  import warnings
  from typing import Any, Dict, List, Optional, Union
  import torch
  from botorch.exceptions.errors import InputDataError, UnsupportedError
  from botorch.utils.containers import BotorchContainer, SliceContainer
  from torch import long, ones, Tensor
label_desc: Use image node_id 2 for calling the RankingDataset obj's underlying member method code with example usage: obj._validate() without return types