(X, **kwargs)
return Xnew
Generic input validation on arrays or lists of arrays.

    Parameters
    ----------
    X : object
        Input object to check / convert.

    **kwargs
        Keyword arguments accepted by
        :func:`sklearn.utils.validation.check_array`, with the following
        caveats: 1) `ensure_2d` and `allow_nd` are ignored; 2) when
        `force_all_finite` is set to ``False``, NaN inputs are not allowed.

    Returns
    -------
    Xnew : ndarray or list
        The converted and validated object.
Generic input validation on arrays or lists of arrays.
Generic input validation on arrays or lists of arrays .
def check_collection(X, **kwargs):
    """Generic input validation on arrays or lists of arrays.

    Parameters
    ----------
    X : object
        Input object to check / convert.

    **kwargs
        Keyword arguments accepted by
        :func:`sklearn.utils.validation.check_array`, with the following
        caveats: 1) `ensure_2d` and `allow_nd` are ignored; 2) when
        `force_all_finite` is set to ``False``, NaN inputs are not allowed.

    Returns
    -------
    Xnew : ndarray or list
        The converted and validated object.

    """
    kwargs_ = kwargs.copy()
    kwargs_.pop('allow_nd', None)
    kwargs_.pop('ensure_2d', None)
    if hasattr(X, 'shape') and hasattr(X, 'ndim'):
        Xnew = _check_array_mod(X, ensure_2d=True, allow_nd=True, **kwargs_)
    else:
        has_check_failed = False
        messages = []
        Xnew = []
        for i, x in enumerate(X):
            try:
                xnew = _check_array_mod(x, ensure_2d=False, allow_nd=True,
                                        **kwargs_)
                Xnew.append(xnew)
            except ValueError as e:
                has_check_failed = True
                messages.append(f"Entry {i}:\n{e}")
        if has_check_failed:
            raise ValueError(
                "The following errors were raised by the inputs:\n\n" +
                "\n\n".join(messages)
                )

    return Xnew
def check_collection ( X , * * kwargs ) : kwargs_ = kwargs . copy ( ) kwargs_ . pop ( 'allow_nd' , None ) kwargs_ . pop ( 'ensure_2d' , None ) if hasattr ( X , 'shape' ) and hasattr ( X , 'ndim' ) : Xnew = _check_array_mod ( X , ensure_2d = True , allow_nd = True , * * kwargs_ ) else : has_check_failed = False messages = [ ] Xnew = [ ] for i , x in enumerate ( X ) : try : xnew = _check_array_mod ( x , ensure_2d = False , allow_nd = True , * * kwargs_ ) Xnew . append ( xnew ) except ValueError as e : has_check_failed = True messages . append ( f"Entry {i}:\n{e}" ) if has_check_failed : raise ValueError ( "The following errors were raised by the inputs:\n\n" + "\n\n" . join ( messages ) ) return Xnew