How prayesh13/book-recommendation-system works
Project Type & Purpose
• The project is a full-stack web application (backend and web UI) that uses a precomputed collaborative filtering model to recommend books.
• Its primary purpose is to display popular books and provide book recommendations based on user input by leveraging CSV-based datasets and pre-trained models (stored as joblib files).
Key Components
a. User Interface:
• Web browser or client interacting with the system.
• The UI is built with HTML templates (found in the “templates” directory) and styled with Bootstrap.
b. Flask Application Backend:
• This is the central component represented by “app.py”.
• It handles user requests, processes inputs, and serves the web pages.
• It interacts with the data/model components to fetch recommendations.
c. Data & Model Layer:
• Data sources, specifically:
• The “book-recommendation-dataset” directory containing CSV files (Books.csv, Ratings.csv, and Users.csv). These files hold raw data about books and user ratings.
• The “model” directory housing precomputed model files (books.joblib, popular.joblib, pt.joblib, similarity_scores.joblib) used to perform the collaborative filtering and similarity calculations.
• “books_data.py” script which likely encapsulates data access or processing logic that bridges raw CSV data and the recommendation process.
d. Static Assets:
• “static” directory (with subdirectories like “images”) used to serve static resources (CSS, images, JS) for the web interface.
Relationships & Data Flow
• Within the backend:
• That “app.py” communicates with the Data & Model Layer (via “books_data.py” and the model’s joblib files) to retrieve relevant data and computed similarity scores.
• That the backend uses data from the CSV dataset and the pre-trained models to execute the recommendation algorithm.
Architectural Patterns & Design Principles
• The architecture follows an MVC-like pattern:
• The “Templates” (View) provide the front-end UI.
• The “Flask Application” (Controller) handles requests and business logic.
• The “Data & Model Layer” (Model) manages the recommendation logic and data persistence.
• The separation of concerns is clear between the presentation layer, application logic, and data processing layer.
• That the precomputed similarity scores and joblib models enable fast and efficient recommendation retrieval, reducing runtime computation.