July 2017
Intermediate to advanced
360 pages
8h 26m
English
For our purposes, we need to create a dummy dataset of users and products:
import numpy as np>>> nb_users = 1000>>> users = np.zeros(shape=(nb_users, 4))>>> for i in range(nb_users):>>> users[i, 0] = np.random.randint(0, 4)>>> users[i, 1] = np.random.randint(0, 2)>>> users[i, 2] = np.random.randint(0, 5)>>> users[i, 3] = np.random.randint(0, 5)
We assume that we have 1,000 users with four features represented by integer numbers bounded between 0 and 4 or 5. It doesn't matter what they mean; their role is to characterize a user and allow for clustering of the set.
For the products, we also need to create the association:
>>> nb_product = 20>>> user_products = np.random.randint(0, nb_product, ...
Read now
Unlock full access