Giter Club home page Giter Club logo

engine's Introduction

Steam Recommendation Engine

This project provides a recommendation engine for Steam games. It uses various machine learning models and techniques to predict and recommend games that a user may be interested in playing.

Features

An API to extract the data. Data preparation Data preprocessing Data modeling (using LightFM with BPR Loss and Warp Loss, and SVD) A frontend for users to input their user ID and receive game recommendations A backend to deploy the model and fetch recommendations Frontend integration with the OpenAI API.

Table of Contents

Installation Usage API Data Preparation Data Preprocessing Data Modeling Frontend Backend OpenAI API Integration

Installation

To run this project on your local machine, please follow these steps:

Clone the repository:

bash Copy code git clone https://github.com/JPBP22/steam-recommendation-engine.git Navigate to the project directory:

bash Copy code cd steam-recommendation-engine Create a virtual environment and activate it (optional but recommended):

bash Copy code python -m venv venv source venv/bin/activate # On Windows, use venv\Scripts\activate Install the required packages:

Copy code pip install -r requirements.txt

Usage

After installing the required packages, follow these steps:

Run the data extraction, preparation, and preprocessing scripts:

Copy code python data_extraction.py python data_preparation.py python data_preprocessing.py Train the recommendation model:

Copy code python train_model.py Start the backend server:

bash Copy code python backend/app.py In a new terminal, navigate to the frontend directory and start the frontend server:

bash Copy code cd frontend yarn yarn dev Open your browser and navigate to http://localhost:3000 to start using the recommendation engine.

API

The project uses the Steam API to extract user data, game details, and user-game interactions.

Data Preparation

The data_preparation.py script is responsible for downloading and processing raw data from the Steam API. This includes fetching game and user information, as well as user-game interactions such as playtime and user ratings.

Data Preprocessing

The data_preprocessing.py script performs various data cleaning and transformation tasks, such as removing duplicates, filtering out irrelevant data, and normalizing the data.

Data Modeling

The train_model.py script trains the recommendation model using the LightFM library with BPR Loss and Warp Loss, as well as Singular Value Decomposition (SVD).

Frontend

The frontend is built using React and allows users to input their user ID and receive game recommendations. The frontend communicates with the backend to fetch recommendations and displays them to the user.

Backend

The backend is built using Flask and is responsible for serving the trained model and providing an API for the frontend to fetch recommendations.

OpenAI API Integration

The frontend is integrated with the OpenAI API to provide additional information and insights about the recommended games. This includes generating game descriptions, reviews, and other relevant information.

Preview

Homepage

image

Recommenders + Chatbot

image

Sources:

· https://github.com/nadinezab/video-game-recs

· https://github.com/haohe1113/Steam-Game-Rcmd-Engine

· https://github.com/abvnithish/Steam_Game_Recommendation_System

· https://python.plainenglish.io/recommendation-engine-with-steam-video-games-dataset-98582c11af69

· https://audreygermain.github.io/Game-Recommendation-System/

· https://towardsdatascience.com/building-a-game-recommendation-engine-870a1ccd11c4

· https://towardsdatascience.com/steam-recommendation-systems-4358917288eb

engine's People

Contributors

jpbp22 avatar henninggc avatar aescf avatar anthonyfyaacoub avatar tvintimilla01 avatar piercegf avatar

Watchers

 avatar  avatar  avatar

engine's Issues

Deployment and CI/CD

Setup the deployment and CI/CD on Microsoft Azure portal and Azure DevOps, waiting on finalisation of front end for testing and to link w/ git repo. Deployment failed as of right now.

Workflow for Data Preprocessing

I worked on a workflow that automates the preprocessing of the data everytime new data is added however I could not achieve that due to the user items dataset being too big to upload on github.

Checklist

  • Model selector in frontend
  • Chatbot (making api call to the openai gpt model)
  • Use a database to store our data (MongoDB).

Feedback MVP1

SVD Modelling problem

When trying to model with the Singular Value Decomposition, I seem to always get a precision score of 0.

Here's the code;

`import numpy as np

Number of latent factors

k = 100

Perform SVD

U, sigma, Vt = svds(train_sparse, k=k)

Convert sigma into a diagonal matrix

sigma = np.diag(sigma)

Reconstruct the interaction matrix

predicted_interactions = np.dot(np.dot(U, sigma), Vt)

Create an inverse mapping from game indices to game IDs

idx_to_game_id = {idx: game_id for idx, game_id in enumerate(games_dict.keys())}
game_id_to_idx = {game_id: idx for idx, game_id in enumerate(games_dict.keys())}

Create a mapping from user IDs to user indices

user_id_to_idx = {user_id: idx for idx, user_id in enumerate(user_dict.keys())}`

`

Evaluation function (Precision@K)

def precision_at_k(predicted_interactions, test_interactions, k):
precisions = []
for user_id in user_dict.keys():
# Get the user index for the current user ID
user_idx = user_id_to_idx[user_id]

    # Get the top K predicted game indices for each user
    top_k_indices = np.argsort(predicted_interactions[user_idx])[-k:]
    
    # Get the game IDs for the top K predicted games using the inverse mapping
    top_k_games = [idx_to_game_id[i] for i in top_k_indices]
    
    # Count how many of these games are in the test set
    relevant_games = 0
    for game_id in top_k_games:
        game_idx = game_id_to_idx[game_id]
        if test_interactions[user_idx, game_idx] > 0:
            relevant_games += 1
            
    # Calculate the precision for the current user and store it
    precision = relevant_games / k
    precisions.append(precision)

# Calculate the average precision across all users
avg_precision = np.mean(precisions)
return avg_precision

Evaluate the model using Precision@K

for k in range(1, 21):
precision_at_k_value = precision_at_k(predicted_interactions, test_sparse, k)
print(f"Precision@{k}: {precision_at_k_value}")
`

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.