December 2018
Beginner to intermediate
226 pages
7h 59m
English
Now, we define a function called sample_points for generating our input (x,y) pairs. It takes the parameter k as input, which implies the number of (x,y) pairs we want to sample:
def sample_points(k): x = np.random.rand(k,50) y = np.random.choice([0, 1], size=k, p=[.5, .5]).reshape([-1,1]) return x,y