

def fit(model, x, y, get=threaded.get, **kwargs):
    " Fit scikit learn model against dask arrays\n\n    Model must support the ``partial_fit`` interface for online or batch\n    learning.\n\n    This method will be called on dask arrays in sequential order.  Ideally\n    your rows are independent and identically distributed.\n\n    Parameters\n    ----------\n    model: sklearn model\n        Any model supporting partial_fit interface\n    x: dask Array\n        Two dimensional array, likely tall and skinny\n    y: dask Array\n        One dimensional array with same chunks as x's rows\n    kwargs:\n        options to pass to partial_fit\n\n    Examples\n    --------\n    >>> import dask.array as da\n    >>> X = da.random.random((10, 3), chunks=(5, 3))\n    >>> y = da.random.random(10, chunks=(5,))\n\n    >>> from sklearn.linear_model import SGDClassifier\n    >>> sgd = SGDClassifier()\n\n    >>> sgd = da.learn.fit(sgd, X, y, classes=[1, 0])\n    >>> sgd  # doctest: +SKIP\n    SGDClassifier(alpha=0.0001, class_weight=None, epsilon=0.1, eta0=0.0,\n           fit_intercept=True, l1_ratio=0.15, learning_rate='optimal',\n           loss='hinge', n_iter=5, n_jobs=1, penalty='l2', power_t=0.5,\n           random_state=None, shuffle=False, verbose=0, warm_start=False)\n\n    This passes all of X and y through the classifier sequentially.  We can use\n    the classifier as normal on in-memory data\n\n    >>> import numpy as np\n    >>> sgd.predict(np.random.random((4, 3)))  # doctest: +SKIP\n    array([1, 0, 0, 1])\n\n    Or predict on a larger dataset\n\n    >>> z = da.random.random((400, 3), chunks=(100, 3))\n    >>> da.learn.predict(sgd, z)  # doctest: +SKIP\n    dask.array<x_11, shape=(400,), chunks=((100, 100, 100, 100),), dtype=int64>\n    "
    assert (x.ndim == 2)
    assert (y.ndim == 1)
    assert (x.chunks[0] == y.chunks[0])
    assert hasattr(model, 'partial_fit')
    if (len(x.chunks[1]) > 1):
        x = x.reblock(chunks=(x.chunks[0], sum(x.chunks[1])))
    nblocks = len(x.chunks[0])
    name = ('fit-' + tokenize(model, x, y, i))
    dsk = {
        (name, (- 1)): model,
    }
    dsk.update(dict((((name, i), (_partial_fit, (name, (i - 1)), (x.name, i, 0), (y.name, i), kwargs)) for i in range(nblocks))))
    return get(merge(x.dask, y.dask, dsk), (name, (nblocks - 1)))

dataset/ETHPy150Open dask/dask/dask/array/learn.py fit/VarMisuse@139/867 `kwargs`->`i`