

def _four_regions_labels(points):
    '\n    Returns labels for points in [-1, 1]^2 from the\n    "four regions" benchmark task first described by\n    Singhal and Wu.\n\n    Parameters\n    ----------\n    points : array_like, 2-dimensional\n        An (N, 2) list of 2-dimensional points.\n\n    Returns\n    -------\n    labels : ndarray, 1-dimensional\n        An N-length array of labels in [1, 2, 3, 4].\n\n    References\n    ----------\n    .. [1] S. Singhal and L. Wu, "Training multilayer perceptrons\n      with the extended Kalman algorithm". Advances in Neural\n      Information Processing Systems, 1, (1988) pp 133-140.\n      http://books.nips.cc/papers/files/nips01/0133.pdf\n    '
    points = np.asarray(points)
    region = np.zeros(points.shape[0], dtype='uint8')
    tophalf = (points[:, 1] > 0)
    righthalf = (points[:, 0] > 0)
    dists = np.sqrt(np.sum((points ** 2), axis=1))
    secondring[(dists > np.sqrt(2))] = 255
    outer = (dists > (5.0 / 6.0))
    region[np.logical_and(tophalf, outer)] = 3
    region[np.logical_and(np.logical_not(tophalf), outer)] = 0
    firstring = np.logical_and((dists > (1.0 / 6.0)), (dists <= (1.0 / 2.0)))
    secondring = np.logical_and((dists > (1.0 / 2.0)), (dists <= (5.0 / 6.0)))
    region[np.logical_and(firstring, righthalf)] = 2
    region[np.logical_and(secondring, np.logical_not(righthalf))] = 2
    region[np.logical_and(secondring, righthalf)] = 1
    region[np.logical_and(np.logical_not(righthalf), (dists < (1.0 / 2.0)))] = 1
    region[np.logical_and(righthalf, (dists < (1.0 / 6.0)))] = 1
    assert (np.all((region >= 0)) and np.all((region <= 3)))
    return region

dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/datasets/four_regions.py _four_regions_labels/VarMisuse@87/365 `region`->`secondring`