Skip to content

Instantly share code, notes, and snippets.

@Mehdi-Amine
Last active June 16, 2020 23:17
Show Gist options
  • Save Mehdi-Amine/b8e779d750c7c434663511934bc9ae7f to your computer and use it in GitHub Desktop.
Save Mehdi-Amine/b8e779d750c7c434663511934bc9ae7f to your computer and use it in GitHub Desktop.
generating a dataset about conditions for happiness
import numpy as np
np.random.seed(42)
s = 500 # number of rows in each combination of categories
# (example: 500 rows with cold tea, fast internet, and good books)
# Making the tea
cold = np.around(np.random.uniform(low=0, high=30, size=(s*4,1)), decimals=3)
hot = np.around(np.random.uniform(low=30, high=60, size=(s*4,1)), decimals=3)
burning = np.around(np.random.uniform(low=60, high=90, size=(s*4,1)), decimals=3)
# Plugging the router
slow = np.around(np.random.uniform(low=0, high=20, size=(s*6,1)), decimals=3)
fast = np.around(np.random.uniform(low=20, high=100, size=(s*6,1)), decimals=3)
# Shelving the books
dislike = np.zeros((s*6,1))
like = np.ones((s*6,1))
# Inviting joy
unhappy = np.zeros((s,1))
happy = np.ones((s,1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment