Last active
April 26, 2020 12:24
-
-
Save Mehdi-Amine/41e04f8faa8808ac655640f7c3ea55e2 to your computer and use it in GitHub Desktop.
Generating a dataset to work with. The labels are the first column plus the product of the second column and 0.5
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
import numpy as np | |
np.random.seed(42) | |
dx = np.random.randint(low=-10, high=11, size=(100,2)).astype(float) | |
dy = (dx[:,0] + dx[:,1]*0.5) | |
dx_train, dx_test, dy_train, dy_test = dx[:80], dx[80:], dy[:80], dy[80:] | |
training_data = list(zip(dx_train, dy_train)) | |
testing_data = list(zip(dx_test, dy_test)) | |
print(f"The first 5 rows of the dataset:\n{np.concatenate((dx, dy.reshape(-1,1)), axis=1)[:5]}") | |
''' | |
Out: | |
The first 5 rows of the dataset: | |
[[-4. 9. 0.5] | |
[ 4. 0. 4. ] | |
[-3. 10. 2. ] | |
[-4. 8. 0. ] | |
[ 0. 0. 0. ]] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment