A 𝗕𝗼𝗼𝗸 𝗥𝗲𝗰𝗼𝗺𝗺𝗲𝗻𝗱𝗮𝘁𝗶𝗼𝗻 𝗦𝘆𝘀𝘁𝗲𝗺 📚 uses algorithms to suggest books based on user preferences and behavior. It personalizes recommendations, helping readers discover new titles that match their interests 🌟.
MIT License
Welcome to the Book Recommendation System! This project is designed to provide personalized book recommendations to users based on their reading preferences, behavior, and ratings. The system uses advanced algorithms like collaborative filtering and content-based filtering to suggest books that align with each user's unique tastes. This README will guide you through the project structure, dataset details, and how to run the system locally.
The dataset used in this project consists of three primary components:
Author Rating is an additional metric introduced in this system to evaluate an author's influence and consistency in producing quality content. This rating is derived by analyzing the number of books an author has written and the average ratings those books have received. This feature helps in providing more balanced recommendations by considering not only individual book ratings but also the overall credibility of the author.
The dataset was collected from Hugging face and includes:
BookID
, Title
, Author
, Genre
, Year
, and CoverImage
.Before using the dataset, it underwent several preprocessing steps:
AverageRating
and GenreFrequency
were derived for enhanced recommendations.Make sure you have the following installed on your machine:
git clone https://github.com/Vaibhav-kesarwani/Books_Recommendation_System.git
cd Book_Recommendation_System
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
books_data.csv
in the root
directory.To run the Book Recommendation System, follow these steps:
Prepare the Dataset:
Ensure that your books_data.csv
file is in the root directory. This file should contain the text data and corresponding books info labels, separated by a colon (:)
.
Run the Script: Execute the main script to load the data and perform books recommendation:
python main.ipynb
The model training is performed within the main.ipynb
script, which processes the text data, tokenizes it, and trains a Plot the model using plotly. You can modify the model architecture, training parameters, or the data processing steps within this script.
def recommend_books(book_title, cosine_sim=cosine_sim):
# Get the index of the book that matches the title
idx = data[data['title'] == book_title].index[0]
# Get the cosine similarity scores for all the books with this book
sim_scores = list(enumerate(cosine_sim[idx]))
# Sort the books based on the similarity scores
sim_scores = sorted(sim_scores, key=lambda x: x[1], reverse=True)
# Get the top 10 most similar books (excluding the input book)
sim_scores = sim_scores[1:11]
# Get the book indices
book_indices = [i[0] for i in sim_scores]
# Return the top 10 most recommended books
return data['title'].iloc[book_indices]
After training the model, you can use it to predict books recommendation from new text inputs. Implement the prediction logic in a separate script or extend main.ipynb
to include a prediction function.
Here is an overview of the project directory structure:
Book_Recommendation_System/
│
├── venv # To store the python library files in the virtual env
├── .gitignore # Containg all the unwanted file venv file and etc.
├── book_data.csv # The dataset file containing Books name, rating and author name labels
├── main.ipynb # Jupyter notebooks for data exploration and analysis
├── requirements.txt # List of dependencies
├── LICENSE # Containg the license for the project
└── README.md # Project documentation (this file)
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions or suggestions, feel free to reach out to me at :
Happy Coding!