wrap_sklearn.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:elm 作者: ContinuumIO 项目源码 文件源码
def _as_numpy_arrs(self, X, y=None, **kw):
    '''Convert X, y for a scikit-learn method numpy.ndarrays
    '''
    if isinstance(X, np.ndarray):
        return X, y, None
    if isinstance(X, xr.Dataset):
        X = MLDataset(X)
    if hasattr(X, 'has_features'):
        if X.has_features(raise_err=False):
            pass
        else:
            X = X.to_features()
    row_idx = get_row_index(X)
    if hasattr(X, 'to_array') and not isinstance(X, np.ndarray):
        X, y = X.to_array(y=y)
        # TODO what about row_idx now?
    # TODO - if y is not numpy array, then the above lines are needed for y
    return X, y, row_idx
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号