An AI-powered dish recommendation system that suggests meals based on your preferences, mood, dietary restrictions, and allergies using content-based filtering and weighted scoring algorithms.
- Smart Recommendations: Content-based filtering with multi-factor scoring
- Safety First: Hard filters for allergies and dietary restrictions
- Mood-Based: Get dishes that match your current mood
- Comprehensive Database: 10,000+ real recipes from Kaggle datasets
- Explainable AI: Understand why each dish was recommended
- Cuisine Diversity: 20+ international cuisines
- Allergen Detection: Automatic allergen identification from ingredients
The recommendation engine uses a weighted scoring system:
Final Score = (
Preference Match × 40% +
Mood Alignment × 30% +
Cuisine Preference × 20% +
Diversity Bonus × 10%
) × Allergy Filter
- Preference Match (40%): Matches your favorite ingredients
- Mood Alignment (30%): Aligns with your current mood (comfort, energizing, light, etc.)
- Cuisine Preference (20%): Prioritizes your favorite cuisines
- Diversity Bonus (10%): Encourages variety by boosting less common options
Before scoring, dishes are filtered by:
- ❌ Allergens (e.g., nuts, dairy, gluten)
- ❌ Dietary restrictions (vegan, vegetarian, gluten-free, etc.)
- ❌ Disliked ingredients
- ❌ Spice level tolerance
- ❌ Time constraints
- ❌ Calorie limits
- ❌ Meal type
Uses real-world Kaggle datasets:
- Recipe Ingredients Dataset (~40,000 recipes with cuisine classification)
- Food Ingredients and Recipe Dataset with Images (13,582 recipes with images)
- Ingredients with 16 Allergen Tags (10,000 USDA ingredients with allergen info)
- Python 3.8+
- Kaggle account and API credentials
-
Clone the repository
cd food-dish-recommender-system -
Install dependencies
pip install -r requirements.txt
-
Setup Kaggle credentials
- Go to https://www.kaggle.com/settings/account
- Scroll to "API" section
- Click "Create New Token" to download
kaggle.json - Place it in:
- Windows:
C:\Users\<YourUsername>\.kaggle\kaggle.json - Linux/Mac:
~/.kaggle/kaggle.json
- Windows:
-
Download datasets
python scripts/setup_kaggle.py
This will download ~500MB of recipe data.
-
Process datasets
python scripts/process_data.py
This merges, cleans, and enriches the data (takes 2-5 minutes).
-
Run the recommender!
python src/main.py
🍽️ FOOD DISH RECOMMENDER SYSTEM
=====================================
Tell me about your preferences!
🚨 ALLERGIES: nuts, dairy
🥗 DIETARY RESTRICTIONS: vegetarian
😊 CURRENT MOOD: 2 (energizing)
🌍 FAVORITE CUISINES: Italian, Thai
❤️ FAVORITE INGREDIENTS: pasta, basil, garlic
🔍 Finding perfect dishes for you...
🎯 YOUR PERSONALIZED RECOMMENDATIONS
=====================================
Recommendation #1
─────────────────────────────────────
🍽️ Garlic Basil Pasta (Italian)
Match Score: 87%
Why this dish:
✅ Contains ingredients you love (92% match)
✅ Perfect for your current mood (100% match)
✅ One of your favorite cuisines (100% match)
⏱️ Total time: 20 minutes
🥗 vegetarian, dairy-free
food-dish-recommender-system/
├── src/
│ ├── models.py # Data models (Dish, UserPreferences)
│ ├── recommendation_engine.py # Core recommendation algorithm
│ ├── data_processor.py # Dataset processing and enrichment
│ └── main.py # CLI application
├── scripts/
│ ├── setup_kaggle.py # Download Kaggle datasets
│ └── process_data.py # Process and merge datasets
├── data/
│ ├── raw/ # Raw Kaggle datasets (gitignored)
│ └── processed/ # Processed dish database (gitignored)
├── requirements.txt # Python dependencies
├── .env.example # Environment configuration template
└── README.md # This file
The system uses content-based filtering where dishes are recommended based on:
- Ingredient similarity to user preferences
- Cuisine type matching
- Mood tag alignment
- Allergen and dietary compatibility
Mood tags are automatically generated using keyword analysis:
- Comfort: Keywords like "creamy", "hearty", "warming", "traditional"
- Light: Keywords like "fresh", "salad", "crisp"
- Energizing: High-protein dishes, Asian cuisine
- Indulgent: Desserts, chocolate, rich ingredients
- Healthy: Nutritious ingredients, superfoods
- Refreshing: Cold dishes, citrus, summer foods
- Adventurous: Exotic cuisines, fusion dishes
Two-stage allergen detection:
- Direct lookup in USDA allergen database (10,000 ingredients)
- Keyword matching for common allergens in ingredient names
Supported allergens:
- Dairy (milk, cheese, butter, cream)
- Nuts (tree nuts, almonds, walnuts, cashews)
- Peanuts
- Eggs
- Soy
- Wheat
- Gluten
- Fish
- Shellfish
- Sesame
- Sulfites
Copy .env.example to .env and customize:
# Recommendation Settings
MIN_MATCH_SCORE=0.3 # Minimum score threshold (0-1)
MAX_RECOMMENDATIONS=10 # Maximum results to return
# Data Paths
DATA_DIR=./data
PROCESSED_DATA_DIR=./data/processed
DB_PATH=./data/dishes.db- Machine learning model for better mood detection
- Collaborative filtering using user ratings
- Recipe image search
- Nutritional optimization
- Meal planning for multiple days
- Web UI with React
- REST API with FastAPI
- User profiles and history tracking
- Social features (share recipes, rate dishes)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - feel free to use this project for learning or commercial purposes.
- Kaggle for providing comprehensive recipe datasets
- USDA for allergen information database
- Community contributors to open food datasets
For issues or questions:
- Create an issue on GitHub
- Check existing issues for solutions
Happy cooking! 🎉
Built with ❤️ for food lovers everywhere