Product2Vec model for finding complementary and fungible products
Project description
product2vec
product2vec is a Python library that implements Product2Vec model. It is capable of finding complements and substitutes among products given shopping baskets. Current implementation is based on the original paper: https://ssrn.com/abstract=3519358
Installation
pip install product2vec
Usage
>>> from product2vec import Product2Vec
>>> # toy dataset with two baskets and 4 products
>>> data = [
... ['coffee', 'cookies', 'chocolate'],
... ['tea', 'cookies', 'chocolate'],
... ]
>>> prod2vec = Product2Vec(vector_size=3, min_count=1, sample=0, seed=1, workers=1)
>>> _ = prod2vec.fit(data)
>>> prod2vec.show_substitutes(product='tea', topn=2)
[('coffee', 0.024425969), ('chocolate', 0.023691988)]
>>> prod2vec.show_complements(product='cookies', topn=2)
[('chocolate', 0.5030633), ('coffee', 0.5007087)]
Refer to usage_example.ipynb
which can be found in GitHub repository for short model description and elaborate usage.
Contributing
If you spot any bugs or have suggestions don't hesitate to open an issue.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
product2vec-0.1.0.tar.gz
(11.8 kB
view hashes)
Built Distribution
Close
Hashes for product2vec-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b021baa8867ebaaf002d4ed333673025dea8ca5e50f2c0da72950753ad9512f7 |
|
MD5 | 855885b1f11d44d17a1a89a10eaa6a0f |
|
BLAKE2b-256 | 1489bfdb8645b0d8d841fd60d65ce1e49d0d57b40238148ce02da5fdf08d156d |