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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file product2vec-0.1.0.tar.gz.
File metadata
- Download URL: product2vec-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bb9dfff76cd22cef23b5137d9513e72b3332cdd953f0c0efb1651eac043798c
|
|
| MD5 |
397526cfc41db58c0aa8491bc8a2cbde
|
|
| BLAKE2b-256 |
611f08b4129a2b85e28af93a0400be77e5709db9917b3fba540e5ea747b8fded
|
File details
Details for the file product2vec-0.1.0-py3-none-any.whl.
File metadata
- Download URL: product2vec-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b021baa8867ebaaf002d4ed333673025dea8ca5e50f2c0da72950753ad9512f7
|
|
| MD5 |
855885b1f11d44d17a1a89a10eaa6a0f
|
|
| BLAKE2b-256 |
1489bfdb8645b0d8d841fd60d65ce1e49d0d57b40238148ce02da5fdf08d156d
|