Giter Site home page Giter Site logo

randolphvi / next-basket-recommendation Goto Github PK

View Code? Open in Web Editor NEW
48.0 48.0 19.0 26 KB

About Next Basket Recommendations Based on Neural Network.

License: Apache License 2.0

Python 100.00%
market-basket-analysis pytorch recommender-system rnn tensorflow

next-basket-recommendation's Introduction

🍻 Welcome stranger

  • 🎓: A Ph.D graduated from University of Science and Technology of China (USTC).
  • 🎯: Interested in NLP & Education area. Mainly Focusing on Hierarchical Multi-label Classification Tasks.
  • 👾: I'm a die-hard fan of the Fallout ☢️ and Witcher 🐺 series, and I especially love CRPG games & indie games. Feel free to add my Steam.

🧰 My Projects

  • 🛠 Multi-label Classification: a collection of deep neural network models for beginners, designed to solve Multi-label Classification problems, built in TensorFlow.
  • 🛠 Semantic Textual Similarity: a collection of deep neural network models for beginners, designed to solve Semantic Textual Similarity problems, built in TensorFlow.
  • 📚 Question Difficulty Prediction: a collection of deep neural network models for Question Difficulty Prediction problems, built in TensorFlow & PyTorch.
  • 🍻 HARNN: an attention-based recurrent network Approach for Hierarchical Multi-label Text Classification (HMC), accepted at CIKM 2019 and built in TensorFlow. [Papers] | [Code]
  • 🍻 HmcNet: a general approach that incorporates both explicit and implicit class hierarchy constraints, designed to solve Hierarchical Multi-label Text Classification (HMC), accepted at TKDE 2022 and built in PyTorch. [Papers] | [Code]
  • 🍻 HMNet: a multi-modal method that captures class dependencies to solve Educational Video Concept Prediction problems, accepted at JMLC 2023. [Papers]

🎉 News

  • [2023 Aug] Gods Among Us, Baldur's Gate 3!
  • [2023 Jun] I've suffered in the Darkest Dungeon, and no one is spared!
  • [2023 May] I've been engrossed in the The Legend of Zelda: Tears of the Kingdom, Nintendo rules the fxxking world!
  • [2023 Apr] I've cleared Octopath Traveler II, スクエニさん、さすがかよ!
:octocat: All Works

:octocat: 2023

:octocat: 2022

:octocat: 2021

:octocat: 2020

:octocat: 2019

next-basket-recommendation's People

Contributors

randolphvi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

next-basket-recommendation's Issues

Can you upload the file "neg_sample.pickle"?

Hi, dear RandolphVI,

I trying to run your code, the Anaconda with Python 3.6 (3.6.9) was already downloaded and installed, as well as, all needed frameworks also were installed... But after I run the train.py in Spyder the code ended with errors, because there is no "neg_sample.pickle" in the "data" folder. So, can you upload this file? Or can you give the example of its structure, from which one can understand what should be inside this file?

P.S.: I used your files "test_sample.json", "train_sample.json" and "validation_sample.json" as corresponding files mentioned in "config.py" by "self.TESTSET_DIR", "self.TRAININGSET_DIR" and "self.VALIDATIONSET_DIR". The only file that is absent is "neg_sample.pickle".

Sincerely Yours,
Sergey.

Some questions about the operation of the algorithm

@RandolphVI, can you recommend, please, what paramemers in config.py should be changed
to reduce RAM memory usage? The initial preprocessing of the data (time after start of the train.py and before the start of 1st epoch's calculation) consumes 7 min (200 epoches consumes 1-1,5 hours) and my pc is almost unavailable due to memory overusage. So, it's better to reduce this processing time and RAM usage. Can you give advice how? There are parameters in Config.py:

self.cuda = False
self.clip = 10
self.epochs = 1# = 200
self.batch_size = 256
self.seq_len = 12
self.learning_rate = 0.01  # Initial Learning Rate
self.log_interval = 1  # num of batches between two logging
self.basket_pool_type = 'avg'  # ['avg', 'max']
self.rnn_type = 'LSTM'  # ['RNN_TANH', 'RNN_RELU', 'LSTM', 'GRU']
self.rnn_layer_num = 2
self.dropout = 0.5
self.num_product = 26991+1  # 商品数目,用于定义 Embedding Layer - Number of products, used to define Embedding Layer
self.embedding_dim = 32  # 商品表征维数, 用于定义 Embedding Layer - Product characterization dimension to define Embedding Layer
self.neg_num = 500  # 负采样个数 - Number of negative samples
self.top_k = 10  # Top K 取值 - Top K Value

May be, "top_k" value or "embedding_dim" should be reduced? Or something like this?
Parameters can be linked with each other and, possibly, should be changed together,
and I doubt to change them, because I don't know the code such precisely now.

P.S.: I observed problems with the code (in Win OS) and made these changes to fix them:

logging.info("!!! DREAM Model Training...") #"✔︎ DREAM Model Training..."
# logger = dh.logger_fn("torch-log", "logs/training-{0}.log".format(time.asctime()))
logger = dh.logger_fn("torch-log", "logs/Training {0}.log".format(time.strftime("%a %d-%b-%Y %H.%M.%S")))

And after I replaced all symbols , and the code run like clockwork.
May be, these changes should be added to the next update in the repo?

UPD. I already figured out the question.

runing your code on gpu

hi i read your code and need too run on gpu but your model in train just working on cpu can you change
torch.mm(du_latest, item_embedding[negtives].t()).data.numpy()[0]

Prediction

How to make the prediction after training the model?

caculation for hitratio and ndcg

The hitratio and ndcg will be influenced by neg sample numbers. I think the calculation method for these two metrics might be wrong in some way.
The example is when neg sample is 1, the ndcg will larger than 1 and hitratio will always be 1, and when neg sample is rather small, the hitratio will be much smaller.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.