An AI/ML recommendation system built w/ Python, that has collaborative filtering, matrix factorization, and content-based filtering.
- Python 3.9+
- FastAPI (REST API framework)
- scikit-learn (ML algorithms)
- Pandas & NumPy (data processing)
# Install dependencies
pip install -r requirements.txt
# Generate sample data
python3 generate_data.py
# Test models
python3 models.py
# Start API server
python3 api.pyVisit http://localhost:8000/docs for interactive API documentation.
- Collaborative Filtering (User & Item-based)
- Matrix Factorization (SVD)
- Content-Based Filtering
- RESTful API with Swagger docs
- Real-time recommendations
POST /recommend- get personalized recommendationsGET /movies- browse moviesGET /health- health check
- Collaborative Filtering: Finds similar users/items using cosine similarity
- Matrix Factorization: SVD-based latent factor model
- Content-Based: Recommends based on genre and features
movie-recommendation-system/
├── api.py # FastAPI server w/ recommendation endpoints
├── models.py # ML models (Collaborative Filtering, Matrix Factorization)
├── generate_data.py # synthetic dataset generator
├── test_system.py # testing script for validation
├── requirements.txt # python dependencies
├── README.md # project documentation
├── .gitignore # Git ignore rules
│
├── movies.csv # generated movie data (100 movies)
├── users.csv # generated user data (50 users)
└── ratings.csv # generated ratings data (~1000 ratings)
api.py: FastAPI REST API server with endpoints for recommendations, movies, and health checksmodels.py: Implementation of recommendation algorithmsSimpleRecommender: Item-based collaborative filteringMatrixFactorization: SVD-based factorization model
generate_data.py: Creates synthetic movie dataset with realistic rating patternstest_system.py: Automated testing for data, models, and APIrequirements.txt: All Python package dependencies