Created
May 14, 2020 15:22
-
-
Save Sentdex/454cb20ec5acf0e76ee8ab8448e6266c to your computer and use it in GitHub Desktop.
create_data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://cs231n.github.io/neural-networks-case-study/ | |
def spiral_data(points, classes): | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
epicccc