10a29fce061599788c78410306b215069cf92d97,dklearn/utils.py,,check_X_y,#Any#Any#,53

Before Change


            raise ValueError("X and y must share first dimension")
        elif X.chunks[0] != y.chunks[0]:
            raise ValueError("X and y chunks must be aligned")
    if y is not None and y is not False:
        X_is_dask = isinstance(X, Base)
        if X_is_dask != isinstance(y, Base):
            raise TypeError("X and y may not be mix of "
                            "non-dask and dask objects.)
        if X_is_dask and type(X) != type(y):
            raise TypeError("Dask type of X and y must match")
    if y is False:
        return X
    return X, y

After Change


    if has_y and (x_is_collection != y_is_collection):
        raise TypeError("X and y may not be mix of "
                        "non-dask and dask objects.)
    if not x_is_collection and not y_is_collection:
        if has_y:
            sklearn.utils.check_consistent_length(X, y)
        return X, y

    x_is_array = isinstance(X, da.Array)
    y_is_array = isinstance(y, da.Array)

    if has_y and x_is_array != y_is_array:
        raise ValueError("If X is a da.Array, y must also be a da.Array")
    if x_is_array and y_is_array:
        if X.ndim != 2:
            raise ValueError("X must be 2 dimensional")
        if y.ndim not in (1, 2):
            raise ValueError("y must be 1 or 2 dimensional")
        if X.shape[0] != y.shape[0]:
            raise ValueError("X and y must share first dimension")
        if X.chunks[0] != y.chunks[0]:
            raise ValueError("X and y chunks must be aligned")
    elif x_is_collection and y_is_collection:
        if X.npartitions != y.npartitions:
            raise ValueError("x and y must have the same number of partitions")

    if y is False:
        return X
    return X, y
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: dask/dask-ml
Commit Name: 10a29fce061599788c78410306b215069cf92d97
Time: 2016-06-27
Author: crist042@umn.edu
File Name: dklearn/utils.py
Class Name:
Method Name: check_X_y


Project Name: arraiy/torchgeometry
Commit Name: 0234315776751221ef9da5d2073e32f9f54c01bb
Time: 2020-11-01
Author: edgar.riba@gmail.com
File Name: kornia/color/yuv.py
Class Name:
Method Name: rgb_to_yuv


Project Name: arraiy/torchgeometry
Commit Name: 0234315776751221ef9da5d2073e32f9f54c01bb
Time: 2020-11-01
Author: edgar.riba@gmail.com
File Name: kornia/color/yuv.py
Class Name:
Method Name: yuv_to_rgb