class_docstr: Class that performs the internal train/valid split on a dataset.
  
  The ``cv`` argument here works similarly to the regular sklearn ``cv``
  parameter in, e.g., ``GridSearchCV``. However, instead of cycling
  through all splits, only one fixed split (the first one) is
  used. To get a full cycle through the splits, don't use
  ``NeuralNet``'s internal validation but instead the corresponding
  sklearn functions (e.g. ``cross_val_score``).
  
  We additionally support a float, similar to sklearn's
  ``train_test_split``.
  
  Parameters
  ----------
  cv : int, float, cross-validation generator or an iterable, optional
    (Refer sklearn's User Guide for cross_validation for the various
    cross-validation strategies that can be used here.)
  
    Determines the cross-validation splitting strategy.
    Possible inputs for cv are:
  
      - None, to use the default 3-fold cross validation,
      - integer, to specify the number of folds in a ``(Stratified)KFold``,
      - float, to represent the proportion of the dataset to include
        in the validation split.
      - An object to be used as a cross-validation generator.
      - An iterable yielding train, validation splits.
  
  stratified : bool (default=False)
    Whether the split should be stratified. Only works if ``y`` is
    either binary or multiclass classification.
  
  random_state : int, RandomState instance, or None (default=None)
    Control the random state in case that ``(Stratified)ShuffleSplit``
    is used (which is when a float is passed to ``cv``). For more
    information, look at the sklearn documentation of
    ``(Stratified)ShuffleSplit``.
code: def __init__(
      self,
      cv=5,
      stratified=False,
      random_state=None,
  ):
      self.stratified = stratified
      self.random_state = random_state
  
      if isinstance(cv, Number) and (cv <= 0):
          raise ValueError(
              "Numbers less than 0 are not allowed for cv "
              "but ValidSplit got {}".format(cv)
          )
  
      if not self._is_float(cv) and random_state is not None:
          raise ValueError(
              "Setting a random_state has no effect since cv is not a float. "
              "You should leave random_state to its default (None), or set cv "
              "to a float value.",
          )
  
      self.cv = cv
  
imports: import warnings
  from collections.abc import Mapping
  from functools import partial
  from numbers import Number
  import numpy
  from scipy import sparse
  from sklearn.model_selection import ShuffleSplit
  from sklearn.model_selection import StratifiedKFold
  from sklearn.model_selection import StratifiedShuffleSplit
  from sklearn.model_selection import check_cv
  import torch
  import torch.utils.data
  from skorch.utils import flatten
  from skorch.utils import is_pandas_ndframe
  from skorch.utils import check_indexing
  from skorch.utils import multi_indexing
  from skorch.utils import to_numpy
label_desc: Use image node_id 1 to create a new ValidSplit object  with example: obj = ValidSplit(cv, stratified, random_state)