Dataset preparation and baseline

Now we are ready to start building a recommender system.

First, declare the imports:

import tensorflow as tfimport pandas as pdimport numpy as npimport scipy.sparse as spfrom tqdm import tqdm

Let us read the dataset:

df = pd.read_excel('Online Retail.xlsx')

Reading xlsx files may take a while. To save time when we next want to read the file, we can save the loaded copy into a pickle file:

import picklewith open('df_retail.bin', 'wb') as f_out:    pickle.dump(df, f_out)

This file is a lot faster to read, so for loading, we should use the pickled version:

with open('df_retail.bin', 'rb') as f_in:    df = pickle.load(f_in)

Once the data is loaded, we can have a look at the data. We can do this by invoking the head ...

Get TensorFlow Deep Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.