当前位置: 首页>>代码示例>>Python>>正文


Python validation.indexable方法代码示例

本文整理汇总了Python中sklearn.utils.validation.indexable方法的典型用法代码示例。如果您正苦于以下问题:Python validation.indexable方法的具体用法?Python validation.indexable怎么用?Python validation.indexable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn.utils.validation的用法示例。


在下文中一共展示了validation.indexable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: split

# 需要导入模块: from sklearn.utils import validation [as 别名]
# 或者: from sklearn.utils.validation import indexable [as 别名]
def split(self, y, exogenous=None):
        """Generate indices to split data into training and test sets

        Parameters
        ----------
        y : array-like or iterable, shape=(n_samples,)
            The time-series array.

        exogenous : array-like, shape=[n_obs, n_vars], optional (default=None)
            An optional 2-d array of exogenous variables.

        Yields
        ------
        train : np.ndarray
            The training set indices for the split

        test : np.ndarray
            The test set indices for the split
        """
        y, exog = indexable(y, exogenous)
        indices = np.arange(y.shape[0])
        for train_index, test_index in self._iter_train_test_masks(y, exog):
            train_index = indices[train_index]
            test_index = indices[test_index]
            yield train_index, test_index 
开发者ID:alkaline-ml,项目名称:pmdarima,代码行数:27,代码来源:_split.py

示例2: to_indexable

# 需要导入模块: from sklearn.utils import validation [as 别名]
# 或者: from sklearn.utils.validation import indexable [as 别名]
def to_indexable(*args, **kwargs):
    """Ensure that all args are an indexable type.

    Conversion runs lazily for dask objects, immediately otherwise.

    Parameters
    ----------
    args : array_like or scalar
    allow_scalars : bool, optional
        Whether to allow scalars in args. Default is False.
    """
    if kwargs.get("allow_scalars", False):
        indexable = _maybe_indexable
    else:
        indexable = _indexable
    for x in args:
        if x is None or isinstance(x, (da.Array, dd.DataFrame)):
            yield x
        elif is_dask_collection(x):
            yield delayed(indexable, pure=True)(x)
        else:
            yield indexable(x) 
开发者ID:dask,项目名称:dask-ml,代码行数:24,代码来源:utils.py

示例3: _indexable

# 需要导入模块: from sklearn.utils import validation [as 别名]
# 或者: from sklearn.utils.validation import indexable [as 别名]
def _indexable(x):
    return indexable(x)[0] 
开发者ID:dask,项目名称:dask-ml,代码行数:4,代码来源:utils.py

示例4: _maybe_indexable

# 需要导入模块: from sklearn.utils import validation [as 别名]
# 或者: from sklearn.utils.validation import indexable [as 别名]
def _maybe_indexable(x):
    return indexable(x)[0] if _is_arraylike(x) else x 
开发者ID:dask,项目名称:dask-ml,代码行数:4,代码来源:utils.py


注:本文中的sklearn.utils.validation.indexable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。