Skip to content

Commit 465d83e

Browse files
committed
update documentation
1 parent 5f460a3 commit 465d83e

25 files changed

Lines changed: 132 additions & 199 deletions

README.md

Lines changed: 68 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,64 @@
1-
## 🔥 BookSage AI
1+
# 🔥 **BookSage AI**
22

3-
**Multi-Method Book Recommendation System**
3+
**Multi-Method Book Recommendation System** Provide personalized book recommendations by combining **Collaborative Filtering** and **Content-Based Filtering** techniques, ensuring high accuracy even when user interaction data is sparse.
4+
5+
[![BookSage AI](https://github.com/user-attachments/assets/ab5d829d-76b1-4207-bb08-442a0eacb684)](https://github.com/user-attachments/assets/ab5d829d-76b1-4207-bb08-442a0eacb684)
6+
7+
---
8+
9+
## 🎯 **Project Goal**
10+
In today’s digital era, readers are overwhelmed with millions of book options across various platforms, making it difficult to find books aligned with their interests, preferences, or past reading history. Traditional search-based discovery methods fall short in providing personalized and engaging reading suggestions.
11+
12+
To address this challenge, the goal is to design and implement a **personalized hybrid book recommendation system** that leverages both **collaborative filtering** (based on user behavior and ratings) and **content-based filtering** (based on book metadata like author, publisher, and year). The system should support:
13+
14+
* Image-based output (for UI-friendly recommendations),
15+
* A fallback mechanism for cold-start scenarios,
16+
* Adjustable weights for hybrid scoring,
17+
* Scalable performance for large datasets.
18+
19+
---
20+
21+
## 🌐 **Live Demo**
22+
23+
🔗 **Try the Hybrid Book Recommendation System live:**
24+
👉 [https://booksage-ai.onrender.com/](https://booksage-ai.onrender.com/)
25+
26+
---
27+
28+
## 🧠 **Core Technologies**
29+
30+
| **Category** | **Technology/Resource** |
31+
|----------------------------|----------------------------------------------------------------------------------------|
32+
| **Core Framework** | Python 3.9+, Pandas, NumPy |
33+
| **Data Processing** | Pandas (Data Cleaning), scikit-learn (Feature Engineering) |
34+
| **Recommendation Models** | Hybrid System: Collaborative Filtering + Content-Based Filtering |
35+
| **Collaborative Filtering**| Scipy (csr_matrix), sklearn.neighbors (NearestNeighbors) |
36+
| **Content-Based Filtering**| sklearn (TfidfVectorizer, cosine_similarity) |
37+
| **Data Sources** | Book-Crossing Dataset (BX-Books, BX-Users, BX-Ratings) |
38+
| **Feature Engineering** | TF-IDF (Title+Author+Publisher+Year combined features) |
39+
| **Model Persistence** | Pickle (Model Serialization) |
40+
| **Evaluation Metrics** | Implicit (Rating counts, Popularity filtering) |
41+
| **Deployment Ready** | Modular functions with error handling and fallback mechanisms |
442

5-
![Image](https://github.com/user-attachments/assets/bc72c776-4cc8-4966-a678-00efaee64334)
643
---
744

8-
## 🎯 Project Goal
45+
## ⚖️ **Comparison with Standard Systems**
946

10-
Provide personalized book recommendations by combining **Collaborative Filtering** and **Content-Based Filtering** techniques, ensuring high accuracy even when user interaction data is sparse.
47+
| Feature | BookSage AI | Typical Recommenders |
48+
|---------|------------|----------------------|
49+
| Method Flexibility | ✅ 3 modes + hybrid tuning | ❌ Usually single-method |
50+
| Cold Start Handling | ✅ Popular books fallback | ❌ Often fails |
51+
| Explainability | ✅ Shows scores + metadata | ❌ Black-box results |
52+
| UI Customization | ✅ Adjustable weights/counts | ❌ Fixed parameters |
1153

1254
---
1355

14-
# 📂 Project Structure for **BookSage AI**
56+
## 📂 Project Structure for **BookSage AI**
1557

1658
```bash
1759
BookSage-AI/
1860
19-
├── app/
61+
├── src/
2062
│ ├── __init__.py
2163
│ ├── config.py
2264
│ ├── data_loader.py
@@ -52,69 +94,29 @@ BookSage-AI/
5294
├── README.md # Project Documentation
5395
├── .gitignore # Files/folders to ignore in GitHub repo
5496
├── app.png # Demo
97+
├── demo.webm # Demo Video
5598
5699
└── LICENSE # License
57100
```
58101

59102
---
60103

61-
## 🧠 Core Technologies
62-
63-
| Technology | Purpose |
64-
|---------------------|--------------------------------------------|
65-
| Python 3.11 | Core Programming Language |
66-
| Streamlit | Frontend Web Application Framework |
67-
| Scikit-learn | Machine Learning Model Building |
68-
| Pandas, NumPy | Data Manipulation |
69-
| Docker | Containerization |
70-
| GitHub Actions | CI/CD Automation |
71-
| Logging (Python) | Application Monitoring |
72-
73-
---
74-
75-
## 📦 Major Components
76-
77-
| Component | Description |
78-
|--------------------------------|--------------------------------------------------------------|
79-
| Data Loader | Data reading and preprocessing |
80-
| Content-Based Recommender | Recommend books based on metadata similarities |
81-
| Collaborative Filtering Engine | Recommend books based on user preferences |
82-
| Hybrid Recommendation Engine | Combines content-based and collaborative outputs |
83-
| Streamlit Frontend | Interactive UI for Book Recommendations |
84-
| Centralized Logger | Real-time Monitoring and Debugging Support |
85-
| CI/CD Pipeline (GitHub Actions)| Automated Testing, Docker Build, Deployment Automation |
86-
87-
---
88-
89-
## 🌐 Deployment Plan
90-
91-
### Local Development
92-
93-
- Virtual Environment setup
94-
- Running via `main run`
95-
- Local Logging for debugging
96-
97-
### Dockerized Deployment
98-
99-
- Dockerfile included
100-
- Docker Build and Run commands
101-
- Ideal for consistent environments across development, staging, and production.
102-
103-
### CI/CD Pipeline (Implemented)
104-
105-
- **GitHub Actions Workflow**:
106-
- On Push or Pull Request:
107-
- Linting and Code Quality Checks
108-
- Run Unit Tests (Optional pytest Integration)
109-
- Build Docker Image
110-
- Push to DockerHub (Private/Public Repo)
111-
- Deploy to Cloud (Future ready)
112-
113-
> ✅ Future Scope: Auto-deploy to AWS ECS / Azure App Service / GCP Cloud Run.
104+
### 🧬 **Architecture Diagram (Mermaid)**
105+
```mermaid
106+
graph TD
107+
A[Raw Data] --> B[Data Preprocessing]
108+
B --> C[Collaborative Filtering Model]
109+
B --> D[Content-Based Model]
110+
C --> E[User-Item Matrix]
111+
D --> F[TF-IDF Features]
112+
E --> G[Hybrid Recommender]
113+
F --> G
114+
G --> H[Recommendation via Streamlit]
115+
```
114116

115117
---
116118

117-
## 🛠️ How to Setup (Locally)
119+
## 🛠️ **How to Setup (Locally)**
118120

119121
```bash
120122
# Clone the Repository
@@ -134,7 +136,7 @@ streamlit run main.py
134136

135137
---
136138

137-
## 🐳 How to Setup (Dockerized)
139+
## 🐳 **How to Setup (Dockerized)**
138140

139141
```bash
140142
# Clone the Repository
@@ -150,33 +152,7 @@ docker run -p 8501:8501 booksage-ai
150152

151153
---
152154

153-
## 🛡️ Logging Mechanism
154-
155-
- Centralized Logger module with customizable Log Levels
156-
- Logs critical events like data loading issues, recommendation failures, server errors
157-
- Supports both **Console Output** and **File Saving**
158-
159-
Example Usage:
160-
```python
161-
from app.logger import get_logger
162-
logger = get_logger()
163-
164-
logger.info("User requested new book recommendations.")
165-
logger.error("Failed to generate collaborative recommendations.")
166-
```
167-
168-
---
169-
170-
## 🧪 Test Setup (Optional)
171-
172-
- Currently no pytest implemented.
173-
- Future Scope:
174-
- Add Unit Tests for each recommender engine.
175-
- Integrate Test Execution in CI/CD.
176-
177-
---
178-
179-
## ⚙️ CI/CD Pipeline (Full Flow)
155+
## ⚙️ **CI/CD Pipeline (Full Flow)**
180156

181157
| Step | Tool | Purpose |
182158
|---------------------------------|---------------|--------------------------------------|
@@ -187,64 +163,9 @@ logger.error("Failed to generate collaborative recommendations.")
187163
| Push Image to DockerHub | GitHub Actions| Automatic Push after Build |
188164
| Deploy to Server (future ready) | GitHub Actions| Auto-deploy on Cloud or VPS server |
189165

190-
---
191-
**Sample GitHub Actions Workflow (`.github/workflows/main.yml`)**
192-
```yaml
193-
name: Docker Image CI-CD
194-
195-
on:
196-
push:
197-
branches: [ "master" ]
198-
pull_request:
199-
branches: [ "master" ]
200-
201-
jobs:
202-
build:
203-
204-
runs-on: ubuntu-latest
205-
206-
steps:
207-
- name: Checkout code
208-
uses: actions/checkout@v3
209-
210-
- name: Set up Python
211-
uses: actions/setup-python@v4
212-
with:
213-
python-version: '3.x'
214-
215-
- name: Set up Docker Buildx
216-
uses: docker/setup-buildx-action@v2
217-
218-
- name: Cache Docker layers
219-
uses: actions/cache@v3
220-
with:
221-
path: /tmp/.buildx-cache
222-
key: ${{ runner.os }}-buildx-${{ github.sha }}
223-
restore-keys: |
224-
${{ runner.os }}-buildx-
225-
226-
- name: Build Docker image
227-
run: docker build -t BookSage-AI .
228-
229-
- name: Test the application (Run tests inside container)
230-
run: docker run --rm BookSage-AI pytest tests/
231-
```
232-
233166
---
234167

235-
## 📑 Extra Features
236-
237-
| Feature | Details |
238-
|-----------------------------|------------------------------------------------------|
239-
| Adjustable Weighting | User can adjust importance between Collaborative vs Content-Based results dynamically |
240-
| Popularity Fallback System | If recommendation engines fail, fallback to Top-rated Books |
241-
| Modular Code Structure | Easier Maintenance and Testing |
242-
| Scalability Ready | Optimized for future Cloud Hosting |
243-
244-
---
245-
246-
247-
# 🚀 Conclusion
168+
## 🚀 **Conclusion**
248169

249170
The **Hybrid Book Recommendation System** is a **production-ready, scalable**, and **cloud-deployable** application blending the strengths of multiple recommendation techniques, backed by a complete CI/CD pipeline ensuring continuous improvement and smooth deployments.
250171

@@ -256,7 +177,7 @@ The **Hybrid Book Recommendation System** is a **production-ready, scalable**, a
256177
📧 **Email:** iconicemon01@gmail.com
257178
💬 **WhatsApp:** [+8801834363533](https://wa.me/8801834363533)
258179
🔗 **GitHub:** [Md-Emon-Hasan](https://github.com/Md-Emon-Hasan)
259-
🔗 **LinkedIn:** [Md Emon Hasan](https://www.linkedin.com/in/md-emon-hasan)
180+
🔗 **LinkedIn:** [Md Emon Hasan](https://www.linkedin.com/in/md-emon-hasan-695483237/)
260181
🔗 **Facebook:** [Md Emon Hasan](https://www.facebook.com/mdemon.hasan2001/)
261182

262-
---
183+
---

app/BookSageAI.egg-info/PKG-INFO

Lines changed: 0 additions & 27 deletions
This file was deleted.

app/BookSageAI.egg-info/SOURCES.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

app/BookSageAI.egg-info/dependency_links.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/BookSageAI.egg-info/requires.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

app/BookSageAI.egg-info/top_level.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
-168 Bytes
Binary file not shown.
-1.12 KB
Binary file not shown.

demo.webm

5.45 MB
Binary file not shown.

logs/2025-05-16.log

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[2025-05-16 13:53:47,210] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\cf_model.pkl
2+
[2025-05-16 13:53:47,227] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\book_pivot.pkl
3+
[2025-05-16 13:53:47,238] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\tfidf_vectorizer.pkl
4+
[2025-05-16 13:53:47,252] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\content_sim_matrix.pkl
5+
[2025-05-16 13:53:47,253] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\title_to_idx.pkl
6+
[2025-05-16 13:53:47,256] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\books_content.pkl
7+
[2025-05-16 13:53:47,286] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\final_rating.pkl
8+
[2025-05-16 13:53:47,519] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\books_data.pkl
9+
[2025-05-16 13:54:11,195] INFO - Collaborative recommendations generated for: A Time to Kill
10+
[2025-05-16 13:54:11,196] ERROR - Error in content recommendations: index 953 is out of bounds for axis 0 with size 742
11+
[2025-05-16 13:54:11,196] INFO - Hybrid recommendations generated for: A Time to Kill
12+
[2025-05-16 13:54:32,091] INFO - Collaborative recommendations generated for: A Time to Kill
13+
[2025-05-16 13:54:37,498] ERROR - Error in content recommendations: index 953 is out of bounds for axis 0 with size 742
14+
[2025-05-16 13:54:37,523] INFO - Popular books fetched.
15+
[2025-05-16 13:54:49,384] ERROR - Error in content recommendations: index 3743 is out of bounds for axis 0 with size 742
16+
[2025-05-16 13:54:49,402] INFO - Popular books fetched.
17+
[2025-05-16 13:54:57,896] ERROR - Error in content recommendations: index 9621 is out of bounds for axis 0 with size 742
18+
[2025-05-16 13:54:57,914] INFO - Popular books fetched.
19+
[2025-05-16 13:55:34,881] INFO - Content-based recommendations generated for: The Kiss
20+
[2025-05-16 13:56:59,914] INFO - Collaborative recommendations generated for: The Kiss
21+
[2025-05-16 13:56:59,917] INFO - Content-based recommendations generated for: The Kiss
22+
[2025-05-16 13:56:59,917] INFO - Hybrid recommendations generated for: The Kiss
23+
[2025-05-16 13:57:12,515] INFO - Collaborative recommendations generated for: The Kiss
24+
[2025-05-16 13:57:17,835] INFO - Content-based recommendations generated for: The Kiss
25+
[2025-05-16 13:59:46,209] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\cf_model.pkl
26+
[2025-05-16 13:59:46,215] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\book_pivot.pkl
27+
[2025-05-16 13:59:46,218] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\tfidf_vectorizer.pkl
28+
[2025-05-16 13:59:46,221] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\content_sim_matrix.pkl
29+
[2025-05-16 13:59:46,222] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\title_to_idx.pkl
30+
[2025-05-16 13:59:46,224] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\books_content.pkl
31+
[2025-05-16 13:59:46,254] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\final_rating.pkl
32+
[2025-05-16 13:59:46,473] INFO - Loaded model/data from C:\Users\emon1\Desktop\Focus\BookSage-AI\src\..\models\books_data.pkl
33+
[2025-05-16 14:01:09,204] INFO - Collaborative recommendations generated for: The Kiss
34+
[2025-05-16 14:01:09,205] INFO - Content-based recommendations generated for: The Kiss
35+
[2025-05-16 14:01:09,208] INFO - Hybrid recommendations generated for: The Kiss
36+
[2025-05-16 14:01:17,973] INFO - Collaborative recommendations generated for: The Kiss
37+
[2025-05-16 14:01:26,058] INFO - Collaborative recommendations generated for: The Kiss
38+
[2025-05-16 15:31:32,126] INFO - Content-based recommendations generated for: The Kiss
39+
[2025-05-16 15:32:24,007] INFO - Collaborative recommendations generated for: The Kiss
40+
[2025-05-16 15:32:24,009] INFO - Content-based recommendations generated for: The Kiss
41+
[2025-05-16 15:32:24,009] INFO - Hybrid recommendations generated for: The Kiss
42+
[2025-05-16 15:32:32,784] INFO - Collaborative recommendations generated for: The Kiss
43+
[2025-05-16 15:32:39,830] INFO - Content-based recommendations generated for: The Kiss

0 commit comments

Comments
 (0)