Recommendations based on customer history.
https://git.picalike.corpex-kunden.de/picalike/personalization
working version is in master branch
host: sandy.picalike.corpex-kunden.de
database: you_api
shops gmm and product quantization lookup table for each shop
products pq vector and image url for each product
customers fisher vector, purchased products, recommendations and info about the customers
A visual vocabulary consisting of all the products from the feed is learned using a mixture of gaussians. The results are saved in the shops collection. The visual vocabulary quantizes the feature space into different cells, and image features are soft-assigned to these cells. The assignments are then aggregated over the images of all the purchased products to obtain a customer representation.
The fisher vector is calculated as follows: for each product we take its features from the feature_db and compute the gradient of the log-likelihood of the image wrt the mixing weight, the mean and the covariance (using diagonal covariance matrices). By averaging the gradients over all products, this yields a customer descriptor of size K(1 + 2d), where d is the dimension of the feature space and K is the number of gaussians. The vector is then normalized and saved in the customer collection.
In order to speed up the search for recommended products, we apply product quantization to the products' fisher vectors. The product quantization is learned over all products in the feed and the lookup table is saved in the shops collection.
The asymmetric distance between the customer's fisher vector and the pq vectors of the products returned by a given solr query is calculated and weighted according to gender and categories. The nearest products are saved in the customer collection together with the query and returned by the API.
[no running service]
input: {"s_id": <shop id>, "c_id": <customer id>, "p_list": ["prod_ids": [<product id>], "date": <date of purchase, string format: "yyyy-mm-dd">]} output: "checkout added"
add new checkout to customer history
input: {"s_id": <shop id>, "c_id": <customer id>, "p_list": [<product id>]} output: "images added"
add images of products to customer history (free products too)
input: {"s_id": <shop id>, "c_id": <customer id>, "start_date": <sting format: "yyyy-mm-dd">, "gmm_name": <name of gmm to be used>} output: [<fisher vector>]
calculate fisher vector for customer using products purchased starting from start_date
until now
input: {"s_id": <shop id>, "gmm_name": <name of gmm to be used>, "q": <query>} output: "pq for <n> products"
calculate product quantization code for products in the query result
input: {"s_id": <shop id>, "c_id": <customer id>, "q": <query>, 'n_res': <number of products to return, int>, "gmm_name": <name of gmm to be used>} output: [<list of products>]
get recommended products by query or – if recommendations do not exist yet – match given customer with products returned by the query
input: {“s_id”: <shop id>, “c_id”: <customer id>, “q”: <query>, 'n_res': <number of products to return, int>, “gmm_name”: <name of gmm to be used>}
output: [<list of products>]
match given customer with products returned by the query