Menu Recommendation Tool
Project description
mc-menu-picker
A content-based recommendation system built on McDonald's menu nutrition data. It computes multi-dimensional similarity across numeric, ingredient, and category features and provides the top-N most similar menu items.
✨ Features
| Feature | Description |
|---|---|
| 🔢 Numeric Similarity | Cosine similarity calculation based on calories, fat, carbohydrates, and other numeric fields |
| 🥗 Ingredient Similarity | Jaccard similarity calculation based on one-hot encoded ingredient features |
| 📂 Category Similarity | Jaccard similarity calculation based on one-hot encoded category features |
| ⚖️ Weighted Fusion | Combines three similarity matrices with customizable weights (default [0.4, 0.35, 0.35]) |
| 💻 Local Recommendation | Run python main.py to randomly select items and list top-K similar items |
| 🚀 RESTful API | Launch FastAPI service via ./scripts/api.sh for external calls |
📦 Installation
git clone https://github.com/911218sky/mc-menu-picker.git
cd mc-menu-picker
pip install -r requirements.txt
📊 Data Preparation
Alternative: You can also download the dataset directly - download here.
Step 1: Extract the provided dataset
# Example extraction (adjust path as needed)
unrar x data.rar ./
The program loads raw data and feature matrices, builds or loads the combined similarity matrix, and displays the top-10 recommendations for a random test ID.
🌐 API Service
Start the FastAPI service using the following command:
bash ./scripts/api.sh
Environment Variables
| Environment Variable | Description | Default Value |
|---|---|---|
HOST |
Bind address | 0.0.0.0 |
PORT |
Listening port | 3010 |
PRODUCTION |
If set to true, disables /docs and /redoc endpoints |
false |
📖 API Documentation
After startup, visit http://localhost:3010/docs to explore the Swagger UI interface.
🔧 Development Notes
- Similarity Calculation: The system combines three different similarity algorithms for numeric, ingredient, and category features
- Flexible Weighting: Weight ratios for different features can be adjusted according to requirements
- High Performance: Pre-computed similarity matrices provide fast recommendation responses
📝 Usage Examples
Local Recommendation:
python ./src/main.py
# Output: Random item and its top-10 similar recommendations
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters