import numpy as np


def spiral_data(points, classes):
    # https://cs231n.github.io/neural-networks-case-study/
    X = np.zeros((points*classes, 2))
    y = np.zeros(points*classes, dtype='uint8')
    for class_number in range(classes):
        ix = range(points*class_number, points*(class_number+1))
        r = np.linspace(0.0, 1, points)  # radius
        t = np.linspace(class_number*4, (class_number+1)*4,
                        points) + np.random.randn(points)*0.2
        X[ix] = np.c_[r*np.sin(t*2.5), r*np.cos(t*2.5)]
        y[ix] = class_number
    return X, y


'''
import matplotlib.pyplot as plt
x, y = spiral_data(1000, 3)
plt.scatter(x[:, 0], x[:, 1], c=y)
plt.show()
'''
