class_docstr: Base class for datasets consisting of labelled pairs `(X, Y)`
  and an optional `Yvar` that stipulates observations variances so
  that `Y[i] ~ N(f(X[i]), Yvar[i])`.
  
  Example:
  
  .. code-block:: python
  
      X = torch.rand(16, 2)
      Y = torch.rand(16, 1)
      feature_names = ["learning_rate", "embedding_dim"]
      outcome_names = ["neg training loss"]
      A = SupervisedDataset(
          X=X,
          Y=Y,
          feature_names=feature_names,
          outcome_names=outcome_names,
      )
      B = SupervisedDataset(
          X=DenseContainer(X, event_shape=X.shape[-1:]),
          Y=DenseContainer(Y, event_shape=Y.shape[-1:]),
          feature_names=feature_names,
          outcome_names=outcome_names,
      )
      assert A == B
docstr: Checks that the shapes of the inputs are compatible with each other.
  
  Args:
      validate_feature_names: By default, we validate that the length of
          `feature_names` matches the # of columns of `self.X`. If a
          particular dataset, e.g., `RankingDataset`, is known to violate
          this assumption, this can be set to `False`.
      validate_outcome_names: By default, we validate that the length of
          `outcomes_names` matches the # of columns of `self.Y`. If a
          particular dataset, e.g., `RankingDataset`, is known to violate
          this assumption, this can be set to `False`.
code: def _validate(
      self,
      validate_feature_names: bool = True,
      validate_outcome_names: bool = True,
  ) -> None:
      r"""Checks that the shapes of the inputs are compatible with each other.
  
      Args:
          validate_feature_names: By default, we validate that the length of
              `feature_names` matches the # of columns of `self.X`. If a
              particular dataset, e.g., `RankingDataset`, is known to violate
              this assumption, this can be set to `False`.
          validate_outcome_names: By default, we validate that the length of
              `outcomes_names` matches the # of columns of `self.Y`. If a
              particular dataset, e.g., `RankingDataset`, is known to violate
              this assumption, this can be set to `False`.
      """
      shape_X = self.X.shape
      if isinstance(self._X, BotorchContainer):
          shape_X = shape_X[: len(shape_X) - len(self._X.event_shape)]
      else:
          shape_X = shape_X[:-1]
      shape_Y = self.Y.shape
      if isinstance(self._Y, BotorchContainer):
          shape_Y = shape_Y[: len(shape_Y) - len(self._Y.event_shape)]
      else:
          shape_Y = shape_Y[:-1]
      if shape_X != shape_Y:
          raise ValueError(
              "Batch dimensions of `X` and `Y` are incompatible."
          )
      if self.Yvar is not None and self.Yvar.shape != self.Y.shape:
          raise ValueError("Shapes of `Y` and `Yvar` are incompatible.")
      if (
          validate_feature_names
          and len(self.feature_names) != self.X.shape[-1]
      ):
          raise ValueError(
              "`X` must have the same number of columns as the number of "
              "features in `feature_names`."
          )
      if (
          validate_outcome_names
          and len(self.outcome_names) != self.Y.shape[-1]
      ):
          raise ValueError(
              "`Y` must have the same number of columns as the number of "
              "outcomes in `outcome_names`."
          )
  
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 5 for calling the SupervisedDataset obj's underlying member method code with example usage: obj._validate(validate_feature_names, validate_outcome_names) without return types