Skip to main content

embedding-based item nearest neighborhoods extraction

Project description

DeepNeighbor


Logo

Embedding-based Retrieval for ANN Search and Recommendations!
View Demo · Report Bug · Request Feature

Python Versions PyPI Version license GitHub repo size Open Source? Yes!

Downloads GitHub Issues Maintenance Ask Me Anything ! made-with-python


DeepNeighbor is a High-level,Flexible and Extendible package for embedding-based information retrieval from user-item interaction logs. Just as the name suggested, 'deep' means deep learning models to get user/item embeddings, while 'neighbor' means approximate nearest neighbor search in the embedding space.
It mainly has two parts : Embed step and Search step by the following codes:

model = Embed(data_path); model.train(),which generates embeddings for users and items (Deep),
model.search(), which looks for Approximate nearest neighbor for seed user/item (Neighbor) .

Install

pip install deepneighbor

How To Use

from deepneighbor import Embed

model = Embed(data,model='gat')
model.train()
model.search(seed = 'Louis', k=10)

Input format

The input data for the Embed() should be a (*.csv or *.txt ) file path (e.g. '\data\data.csv')with two columns in order: 'user' and 'item'. For each user, the item are recommended to be ordered by time.

Models & parameters in Embed()

  • Word2Vec w2v
  • Factorization Machines fm
  • Deep Semantic Similarity Model
  • Siamese Network with triple loss
  • Deepwalk
  • Graph convolutional network
  • Neural Graph Collaborative Filtering algorithm ngcf
  • Matrix factorization mf
  • Graph attention network gat

Model Parameters

deepwalk

model = Embed(data, model = 'deepwalk')
model.train(window_size=5,
            workers=1,
            iter=1
            dimensions=128)
  • window_size Skip-gram window size.
  • workersUse these many worker threads to train the model (=faster training with multicore machines).
  • iter Number of iterations (epochs) over the corpus.
  • dimensions Dimensions for the node embeddings

graph attention network

model = Embed(data, model = 'gat')
model.train(window_size=5,
            learning_rate=0.01,
            epochs = 10,
            dimensions = 128,
            num_of_walks=80,
            beta=0.5,
            gamma=0.5,)
  • window_size Skip-gram window size.
  • learning_rate learning rate for optimizing graph attention network
  • epochs Number of gradient descent iterations.
  • dimensions Dimensions for the embeddings for each node (user/item)
  • num_of_walksNumber of random walks.
  • beta and gammaRegularization parameter.

How To Search

model.search(seed, k)

  • seed The Driver for the algorithms
  • k Number of Nearest Neighbors.

Examples

Open Colab to run the example with facebook data.

Contact

Please contact louiswang524@gmail.com for collaboration or providing feedbacks.

License

This project is under MIT License, please see here for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepneighbor-0.3.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepneighbor-0.3.1-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file deepneighbor-0.3.1.tar.gz.

File metadata

  • Download URL: deepneighbor-0.3.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for deepneighbor-0.3.1.tar.gz
Algorithm Hash digest
SHA256 33016414b1fd0ec8c65d73e77cabfb332cc64891de1472e3a4cc0f2037e9475b
MD5 3b6a5bea8dbe27066a882b1f000870c2
BLAKE2b-256 9197001651967b217dbf30eb71fac624e551379b484fa459026d5a0d87e8bf7d

See more details on using hashes here.

File details

Details for the file deepneighbor-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: deepneighbor-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for deepneighbor-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a3b9ffa7143e80849c79c982d22d81bfa48ab6e0c911ac191d813fb1c3b3bae
MD5 71e2a0f52b78ba439a83f1026b2d809e
BLAKE2b-256 6a05a2d64451010d2b1e1085b9f3403ffc419b5e0579d68e17d54bdb05e75c7f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page