Skip to content

A neural collaborative filtering based movie recommendation system

Notifications You must be signed in to change notification settings

ethan-tsai-tsai/NeuralRec-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Movie Recommendation System

Python Framework ML_Framework License

This is a movie recommendation system based on a Neural Collaborative Filtering model, served via a RESTful API using the Flask framework.

✨ Features

  • Model Training: Trigger the model training process via an API call.
  • Real-time Recommendations: Get instant movie recommendations for a specific user.
  • RESTful API: Recommendation functionality is exposed through an easy-to-integrate API.
  • Automated Documentation: Interactive API documentation is auto-generated using Flasgger (Swagger).

🛠️ Tech Stack

  • Backend: Flask, Flask-CORS
  • Machine Learning: PyTorch, Pandas, Scikit-learn
  • API Docs: Flasgger
  • Dependency Management: Poetry

🚀 Getting Started

1. Prerequisites

2. Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/NeuralRec-System.git
cd NeuralRec-System

# Install dependencies using Poetry
poetry install

3. Download the Dataset

This project uses the MovieLens (small) dataset.

# Download and extract the dataset
wget https://files.grouplens.org/datasets/movielens/ml-latest-small.zip
unzip ml-latest-small.zip -d ml-latest-small/

# (Optional) Remove the zip file
rm ml-latest-small.zip

💡 Usage

1. Start the Service

poetry run python app.py

The service will be running at http://127.0.0.1:5001.

2. Browse API Documentation

After starting the service, you can view detailed information about all APIs and test them interactively at:

http://127.0.0.1:5001/docs/

📡 API Endpoints

POST /train

Triggers the model training process. The latest model is automatically saved upon completion.

  • Request Body: (empty)
  • Success Response:
    {
      "status": "success",
      "message": "Model training completed and saved"
    }

POST /recommend

Gets a list of movie recommendations for a given user ID.

  • Request Body:
    {
      "userId": 1,
      "movieId": 2
    }
  • Success Response:
    {
      "status": "success",
      "data": [10, 25, 150, 300, 550]
    }

POST /save

Manually saves the current state of the model.

  • Request Body: (empty)
  • Success Response:
    {
      "status": "success",
      "message": "Model saved successfully"
    }

📄 License

This project is licensed under the MIT License.

About

A neural collaborative filtering based movie recommendation system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages