Git Product home page Git Product logo

otto-multi-objective-recommender-system's Introduction


We were born to shine ⭐ 🌠
Thank you for sunshine, thank you for rain, thank you for joy, thank you for pain, it's a beautiful day 🌻

Pathompong Muangthong

  • πŸŽ“ Graduated with a BSc in Computer Science from Chulalongkorn University.
  • πŸŽ– Finalist at Intel International Science and Engineering Fair 2017
β€” x β€” x β€” Contact β€” x β€” x β€”
Discord: p4zaa
Dear myself πŸ’Œ :'> When you're feeling down or having a tough day, remember that this is just a moment, not the end. You and I can get through it together. Take a deep breath and let go of the worries that weigh you down. Imagine a garden of flowers, given to you with love, from yourself to yourself. 🌞
here the flower for you, not just a flower but a garden of flowers! 🌞 from me, yourself 😊
🌻🌻🌻🌼🌼🌷🌷🌷🌻🌻🌻🌼🌼🌷 Β  Β  Β   🌞 Β  Β  Β  Β  🐾 Β β›²
🌼🌼🌷🐝🌷🌼🌹🌹🌹🌺🌺🌻🌻🌷       🐾       🐾
πŸŒ»πŸŒ»πŸŒ»πŸŒ»πŸŒ»πŸŒΌπŸŒΌπŸŒ·πŸ•πŸŒ·πŸŒ·πŸŒ»πŸŒ»πŸŒΉ 🐾 Β  Β  Β  Β  🐾
🌷🌷🌷🌹🌹🌹🌹🌹🌹🌼🌼🌼🌼🌼    🌈

otto-multi-objective-recommender-system's People

Contributors

p4zaa avatar

Stargazers

 avatar

Watchers

 avatar  avatar

otto-multi-objective-recommender-system's Issues

Memory-inefficient when call recommendation function

@torch.no_grad()
def recommendation(user_id, model, x_dict, edge_index_dict):
  # Get model decoder
  #model = Model(**model_params)
  with torch.no_grad():
    encoder = model.encoder(data.x_dict, data.edge_index_dict)

  # Get node representations for users and movies
  user_representations = encoder['session']
  movie_representations = encoder['aid']

  # Compute the dot product between user and movie representations to get edge weights
  edge_weights = user_representations.mm(movie_representations.T)

  # Make predictions for each user by taking the top k largest edge weights
  k = 20  # number of recommendations to make
  _, top_k_indices = edge_weights.topk(k, dim=1)
  recommendations = top_k_indices.numpy()

  # Print recommendations for the first user
  print(f'Recommendations for user {user_id}: {recommendations[user_id]}')

This line of code below cause memory crash ;(

session = 1
recommendation(session, model, Rtest_data.x_dict, Rtest_data.edge_index_dict)

To-do list

Data Loader and Preprocessing

  • Using Polars library for better memory and time efficient

    Use Polars for load and sample dataset and then convert to Pandas

  • Create new DataFrame sample and store in drive

    trained_model cannot evaluate in new test set where it wasn't trained
    Created with 10% samples dataset

  • Create separate source_idx and target_idx files with all nodes for later use (load in parquet when used)

    Use all nodes dict index will cause IndexError: index out of range in self

Modeling

  • Create node-level features (which do not have from start) using torch.nn.Embedding

    REF

Training by mini-batch

  • Make train function return model
  • Save model after finished train: torch.save(model, 'path')

Encoding by mini-batch

  • Load saved model: model = torch.load('path')

Validation

Memory improvement

  • Add gc.collect() to the code for clear up memory
  • Add torch.cuda.empty_cache() to clear up GPU RAM

Additional

  • Considering using Node2Vec for initialize node features and edge features

    Example

  • Considering using Word2Vec

    Example

  • ts can be used as edge features (depends on task)

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.