Skip to content

jaideepj2004/Book-Recommendation_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Book Recommendation System

A Flask web application that recommends books based on genre input, using a K-Means clustering model trained on TF-IDF genre vectors. The project is part of a PW Skills industrial training submission and includes complete software documentation (Architecture, HLD, LLD, Wireframe, Project Report).


Table of Contents


Overview

Users select a book genre from a dropdown (populated from the dataset), and the app returns 5 book recommendations from the same K-Means cluster. The recommendation model and book data are pre-trained and saved as book_recommendation_model.pkl and filtered_books.csv respectively.


How It Works

  1. At startup, application.py loads book_recommendation_model.pkl (contains kmeans_model and cluster_books dict) and filtered_books.csv.
  2. A TF-IDF vectorizer is fitted on the genres column of filtered_books.csv.
  3. When a user submits a genre:
    • The genre string is transformed by TF-IDF.
    • K-Means predicts the cluster.
    • 5 random books from that cluster are returned.
genre_vector = tfidf_vectorizer.transform([genre])
cluster = kmeans_model.predict(genre_vector)[0]
recommendations = filtered_df[filtered_df['title'].isin(cluster_books[cluster])].sample(5)

Tech Stack

Component Technology
Backend Python, Flask
ML Model K-Means Clustering (scikit-learn)
Text Features TF-IDF Vectorizer (scikit-learn)
Model Persistence joblib
Data filtered_books.csv (pre-filtered book dataset)
Frontend HTML, CSS (Jinja2 templates)
Logging Python logging module → app.log

Project Structure

Book-Recommendation_System/
├── application.py                   # Flask app — routes, model loading, recommendation logic
├── book_recommendation_model.pkl    # Pre-trained KMeans model + cluster_books dict
├── filtered_books.csv               # Dataset (title, genres, etc.)
├── requirements.txt                 # Python dependencies
├── templates/
│   ├── index.html                   # Genre selection form
│   ├── recommendation.html          # Recommendations display
│   └── error.html                   # Error page
├── static/                          # CSS / JS assets
├── Architecture.pdf                 # System architecture diagram
├── HLD.pdf                          # High Level Design document
├── LLD.pdf                          # Low Level Design document
├── Wireframe.pdf                    # UI wireframes
├── Project Report.pdf               # Full project report
├── DPR.pdf                          # Detailed Project Report
└── README.md

Model Details

Parameter Value
Algorithm K-Means Clustering
Input Features TF-IDF vectors of book genre strings
Output Cluster ID → sample 5 books from that cluster
Persistence joblib.load()

Setup & Running

git clone https://github.com/jaideepj2004/Book-Recommendation_System.git
cd Book-Recommendation_System
pip install -r requirements.txt
python application.py

Open http://0.0.0.0:5000 (or http://localhost:5000).


Documentation

The repository includes complete software engineering documentation produced for PW Skills industrial training:

Document Description
Architecture.pdf Overall system architecture and component interaction
HLD.pdf High Level Design — modules and data flow
LLD.pdf Low Level Design — detailed class/function-level design
Wireframe.pdf UI wireframes for all screens
DPR.pdf Detailed Project Report
Project Report.pdf Complete project write-up

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors