An open API service indexing awesome lists of open source software.

https://github.com/rishi-gupta-data/book-recommendation-system


https://github.com/rishi-gupta-data/book-recommendation-system

pandas python3 scikit-learn

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# ๐Ÿ“š Book Recommendation System

A sophisticated book recommendation engine powered by collaborative filtering techniques (KNN & SVD), featuring an intuitive web interface.

---

## โœจ Features

- ๐Ÿค– **Intelligent Recommendations** using Collaborative Filtering (User-User & Item-Item)
- ๐Ÿ“Š **Similar Books Discovery** via ISBN
- ๐ŸŒ **Interactive Web Interface** (Flask-based)
- ๐Ÿ”‘ **API Endpoints** with Rate Limiting
- ๐Ÿ“ˆ **Performance Metrics** (RMSE, MAE, Precision@K)
- ๐Ÿ”„ **Efficient Data Processing Pipeline**
- ๐Ÿ—‚๏ธ **Well-Structured Codebase** for scalability

---

## ๐Ÿ› ๏ธ Tech Stack

| Category | Tools/Libraries |
|--------------------|-------------------------------|
| ๐Ÿ‘จโ€๐Ÿ’ป **Language** | Python 3.8+ |
| โš™๏ธ **Framework** | Flask |
| ๐Ÿ“Š **Data Handling**| Pandas, NumPy, scikit-learn |
| ๐Ÿ“š **Recommenders** | KNN (Collaborative), SVD (Matrix Factorization) |
| ๐ŸŽจ **Frontend** | HTML, CSS, Bootstrap, Font Awesome |

---

## ๐Ÿ“ Project Structure

๐Ÿ“ฆ **BookRecommendationSystem/**
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ **data/**
โ”‚ โ”œโ”€โ”€ ๐Ÿ“ **raw/** # Original datasets (Books, Ratings, Users)
โ”‚ โ””โ”€โ”€ ๐Ÿ“Š **processed/** # Cleaned & preprocessed data
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ **frontend/**
โ”‚ โ”œโ”€โ”€ ๐ŸŽจ **static/** # CSS, JS, assets
โ”‚ โ””โ”€โ”€ ๐Ÿ“„ **templates/** # HTML files (Jinja2 templates)
โ”‚
โ”œโ”€โ”€ ๐Ÿ’พ **models/** # Trained KNN & SVD models
โ”‚
โ”œโ”€โ”€ ๐Ÿ““ **notebooks/** # Jupyter notebooks for experiments
โ”‚
โ”œโ”€โ”€ ๐Ÿ”ง **src/** # Core Python modules (ETL, recommenders)
โ”‚
โ””โ”€โ”€ ๐Ÿ“ **app.py** # Flask entry point

---

## ๐Ÿ”„ Workflow Overview

```mermaid
flowchart TD
A([๐Ÿ“ User Input: Book/ISBN/User ID]):::start --> B{{๐Ÿ“Š Data Processing}}
B --> C[๐Ÿงน Clean & Preprocess Data]
C --> D[๐Ÿ“ฆ Load Models: KNN / SVD]
D --> E[๐Ÿค– Generate Recommendations]
E --> F[๐Ÿ“ˆ Evaluate with Metrics]
E --> G[๐ŸŒ Render Web Interface]
G --> H([๐Ÿ“š Display Recommended Books]):::end_node

classDef start fill:#00b894,stroke:#fff,color:#fff,stroke-width:2px
classDef process fill:#0984e3,stroke:#fff,color:#fff
classDef decision fill:#fdcb6e,stroke:#2d3436,color:#2d3436
classDef analysis fill:#6c5ce7,stroke:#fff,color:#fff
classDef end_node fill:#d63031,stroke:#fff,color:#fff,stroke-width:2px

B:::decision
C:::process
D:::process
E:::process
F:::analysis
G:::process
````
---
## ๐Ÿง  Models Used

### 1๏ธโƒฃ **KNN (Collaborative Filtering)**

* Uses similarity between users/books based on ratings.
* Finds *nearest neighbors* (similar readers or books).
* Recommends books that similar users liked.

### 2๏ธโƒฃ **SVD (Matrix Factorization)**

* Decomposes the User-Item rating matrix into latent factors.
* Captures *hidden patterns* in reading behavior.
* Generates **personalized recommendations** even for sparse data.
---

## ๐Ÿ“Š Data Pipeline

```mermaid
flowchart LR
A([๐Ÿ“ฅ Raw Data: Books + Users + Ratings]) --> B[๐Ÿงน Preprocessing: Missing Values, Normalization]
B --> C[๐Ÿ—‚๏ธ Train-Test Split]
C --> D1[๐Ÿ”Ž KNN Model Training]
C --> D2[๐Ÿ“ SVD Model Training]
D1 --> E[๐Ÿ“Š Evaluation]
D2 --> E
E --> F([๐Ÿ“š Final Recommendation Engine]):::end_node

%% ๐ŸŽจ Styling
classDef end_node fill:#d63031,stroke:#fff,color:#fff,stroke-width:2px;
```
## ๐Ÿš€ How to Run

1. Install the required dependencies:
```bash
pip install -r requirements.txt
```

2. Run the application:
```bash
python src/webapp/app.py
```

3. Open your browser and visit:
๐Ÿ‘‰ [http://localhost:5000](http://localhost:5000)

---
## ๐Ÿ“ˆ Evaluation Metrics

**RMSE & MAE** โ†’ to measure prediction errors.

**Precision@K & Recall@K** โ†’ to evaluate recommendation accuracy.

**Hit Rate** โ†’ to measure how often recommended books match user preferences.

## ๐Ÿ“ธ Screenshots

![Screenshot (15)](https://github.com/user-attachments/assets/cb62f845-0272-48eb-8f81-1a8e2b9a2426)

![Screenshot (16)](https://github.com/user-attachments/assets/7e2149a0-eeac-435b-81db-ba71f5458c8a)

![Screenshot (17)](https://github.com/user-attachments/assets/41cc0518-4a36-4145-b309-02e94aec8d62)

![Screenshot (18)](https://github.com/user-attachments/assets/39f259f7-002f-4a2c-9cbc-e5a880b17835)

## ๐Ÿ“ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.