Professional Documents
Culture Documents
Phase 2 Report
Phase 2 Report
M ANILA 1EP20IS049
SHRAVANI S L 1EP20IS083
AYESHA MUSKAN KHAN M 1EP20IS107
Sindhuja M
Asst. Professor
Dept. of ISE, EPCET
CERTIFICATE
This is to certify that the project work phase II (18CSP77) entitled “MACHINE LEARNING
BASED BOOK RECOMMENDATION ENGINE IN PYTHON” is a bona fide work carried
out by M ANILA [1EP20IS049], SHRAVANI S L [1EP20IS083] and AYESHA MUSKAN
KHAN
M [1EP20IS107] in the partial fulfillment of the requirements of VIII semester of BACHELOR
OF ENGINEERING in INFORMATION SCIENCE AND ENGINEERING, VISVESVARAYA
TECHNOLOGICAL UNIVERSITY, Belagavi, during the year 2023-24. It is certified that corrections/
suggestions indicated for internal assessment have been incorporated in this Project Phase II (18CSP83)
report deposited in the department library. The project report has been approved as it satisfies the academic
requirements prescribed for the University.
External Viva:
1.
2.
ACKNOWLEDGEMENT
Any achievement, be it scholastic or otherwise does not depend solely on individual efforts but on
the guidance, encouragement, and cooperation of intellectuals, elders, and friends. I want to take
this opportunity to thank them all.
We would like to express our sincere thanks to the management of EPCET for providing the
necessary infrastructure and creating a good environment.
We express our gratitude to Dr. Mrityunjaya V Latte, Principal, and EPCET who has always been a
great source of inspiration.
We would like to express our sincere thanks to Prof. Kemparaju N, Professor and Head of the
Department of Information Science and Engineering, EPCET for his valuable suggestions and
encouragement to do our best in this project work.
We would like to express our gratitude towards our guide Prof. Sindhuja M, Assistant Professor,
Department of ISE, and the project coordinator Prof. Neelima Sahu Assistant Professor,
Department of ISE for their valuable guidance and constant supervision in completing the project
work phase II successfully.
We would like to extend our thanks to all the faculty members of the ISE department for their
valuable input as reviewers during the project work.
Finally, we would like to thank our parents and friends for their support and encouragement in
completing the project work phase II.
M ANILA [1EP20IS049]
SHRAVANI S L [1EP20IS083]
AYESHA MUSKAN KHAN M [1EP20IS107]
ABSTRACT
This project presents a web app that gives book suggestions to users based on their likes and ratings.
It uses two methods to make the suggestions: popularity-based filtering and collaborative filtering.
The first method suggests books that are rated high by everyone, while the second method suggests
books that are similar to a chosen book, based on other users' ratings. The web app is built with
Flask, a Python web framework, and uses data about books and ratings. The data is processed to fit
the methods. The web app has two features- one that shows popularity-based suggestions, and
another that takes a book name and shows collaborative filtering suggestions. The goal of this
project is to create a useful and easy book recommender system that can help online bookstores or
libraries by giving personalized book tips to their customers, based on their preferences.
CONTENTS
Chapter
Description Page No.
No.
1 Introduction 1
1.2 Background 6
1.8 Summary 10
2 Literature Survey 13
3 Requirements Specification 16
4 System Analysis 21
4.1 System Analysis 21
4.2 System Architecture 21
Conclusion 45
References 46
LIST OF FIGURES
Fig. No. Description Page No.
Content-Based Filtering
1.1 2
1.2 Collaborative-based Filtering
3
3.5 PyCharm 17
3.6 Python 18
Chapter 1
INTRODUCTION
1.1 Introduction to the Project
The Project is about a machine learning-based recommendation system for book selection using user-based
collaborative filtering algorithm. A machine learning-based recommendation system is a type of system that
uses patterns and trends in data to predict a user's interests or preferences. It essentially learns from past user
behavior to make these predictions. For example, in an online shopping scenario, the system would analyze a
user's past purchases, browsing history, and ratings. It would then use this information to recommend products
that the user might be interested in. This could include items that are similar to those the user has bought or
liked in the past, or items that other users with similar tastes have shown interest in. The goal of these systems is
to provide personalized recommendations that improve the user experience, increase user engagement, and
ultimately drive more sales or usage. They are a key component of many online platforms, including e-
commerce sites, streaming services, and social media platforms. They help users navigate through large
amounts of information and make choices that are most relevant to them.
This aims to provide an overview of the recommendation systems that are currently used in the online book
shopping domain and to propose a simple and understandable system for book recommendations that help
readers choose the right book to read next. This focuses on the information analysis challenge of the
recommendation system and uses a user-based collaborative filtering approach to measure the similarity
between users and recommend books based on their ratings. User-Based Collaborative Filtering is a technique
used in recommendation systems to predict the items that a user might like based on the ratings given to those
items by other users who have similar tastes.
The first step is to find users who are similar to the target user. This similarity can be calculated using various
methods. Once similar users are identified, the system predicts the rating of an item for the target user that they
haven't rated yet. This prediction is based on the weighted average of the ratings of the item by the users who
are similar to the target user. The weights are the similarity scores between the target user and each of the
similar users. This approach is often used in many websites for building their recommendation systems. This
compares different similarity measures, such as Pearson correlation coefficient, constrained Pearson correlation,
cosine similarity, and Jaccard similarity, and evaluates their performance in recommending books to a user.
This presents the overall architecture and implementation of the proposed system and demonstrates its
effectiveness and efficiency.
Collaborative-based Filtering
Collaborative-based filtering recommender systems are based on past interactions between users and
target items. In simple words here, we try to search for the look-alike customers and offer products
based on what his or her lookalike has chosen. Let us understand with an example. X and Y are two
similar users and X users have watched A, B, and C movies. If the Y user has watched B, C, and D
movies then we will recommend A movie to the Y user and D movie to the X user.
YouTube has shifted its recommendation system from content-based to collaborative-based filtering
techniques. If you have sometimes there are also videos which are not at all related to your history but
then also it recommends it because the other person similar to you has watched it.
of curated content that matches their reading style and genre preferences.
Book Clubs and Reading Communities:
Book clubs and reading communities can leverage recommendation systems to select their next group
read. By considering the collective tastes and previous discussions of the group, the system can propose
books that are likely to spark interest and lively conversation among members.
In each of these scenarios, a book recommendation system serves as a valuable tool for connecting
readers with books that resonate with them, fostering a culture of reading and exploration within the
literary world.
1.2 Background
A book recommendation system works by using machine learning algorithms to suggest books that align with a
user's preferences. Here's a step-by-step explanation:
Data Collection: The first step is to collect data about the books and the users. This includes
information about the books (like author, genre, publication year, etc.), user interactions (like ratings,
reviews, purchase history, etc.), and user demographics (like age, location, etc.).
Data Preprocessing: The collected data is then preprocessed to handle missing values, remove outliers,
and convert text data into a format that can be used by the machine learning algorithms¹.
Exploratory Data Analysis (EDA): EDA is performed to understand the data better. This includes
finding the top-rated books, the most prolific authors, the distribution of ratings, etc.
Building the Recommendation Model:
• Content-Based Filtering: This algorithm recommends books that are similar to the ones the
user has interacted with in the past. For example, if a user likes a particular author's book, they
may like other books by the same author.
• Collaborative Filtering: This algorithm recommends books based on the past interactions of
other users who have similar preferences. For example, if two users have read similar books
and one of them reads a new book, that new book may be recommended to the other user.
• Hybrid Filtering: This combines both content-based and collaborative filtering to make
recommendations.
Making Recommendations: The recommendation model is then used to predict the user's interest and
recommend books accordingly. The system can take into account many parameters like book content
and book quality by filtering user reviews.
Evaluation and Updating: The performance of the recommendation system is evaluated using metrics
like precision, recall, F1-score, etc. The system is regularly updated with new data to ensure that the
recommendations stay relevant.
In essence, a book recommendation system works by understanding the user's preferences and using
combines content-based and collaborative filtering, as well as by incorporating user feedback, diversity,
and exploration⁵. For example, a book recommendation system can personalize the recommendations
by considering the user's reading history, goals, and interests, and also introduce some serendipitous
recommendations by suggesting books that are outside the user's comfort zone, but still relevant and
appealing.
In essence, the future of book recommendation systems is driven by the advancement of machine
learning, natural language processing, and user-centric design, which can provide more relevant,
diverse, novel, and serendipitous book suggestions to readers.
1.8 Summary
It suggests a simple and understandable system for book recommendations that help readers find the
right book to read next. It also compares different similarity measures and evaluates the performance of
the proposed system. The purpose of this project is to enhance the user experience and satisfaction in
online book shopping and to contribute to the field of recommender systems.
Characteristics of Python
Versatile Programming: Python accommodates various programming paradigms, including functional,
structured, and object-oriented programming (OOP).
Scripting & Compilation: It serves both as a scripting language for quick tasks and can be compiled
into byte code for larger software projects.
Dynamic Data Types: Python offers advanced dynamic data types and facilitates on-the-fly type
checking. Memory Management: The language automates garbage collection, managing memory
efficiently without manual intervention.
Integration Capabilities: Python seamlessly integrates with other languages like C, C++, and Java, and
technologies such as COM, ActiveX, and CORBA.
Dynamic Typing: Its dynamic typing system allows for flexible variable assignments, streamlining the
coding process.
OOP Support: Python's support for OOP principles aids in structuring and reusing code, enhancing
maintainability and scalability.
Applications of Python
Python is a versatile and powerful programming language that has many applications in the real world.
Some of the most common and popular applications of Python are:
Web and Internet Development: Python can be used to create web applications, websites, web
services, and web crawlers. It has many frameworks and libraries that support web development, such
as Django, Flask, Pyramid, Bottle, and Beautiful Soup.
Machine Learning and Artificial Intelligence: Python is one of the most widely used languages for
machine learning and artificial intelligence. It has many tools and libraries that facilitate data analysis,
data visualization, and algorithm development, such as NumPy, SciPy, pandas, matplotlib, seaborn,
scikit-learn, TensorFlow, and Keras.
Game Development: Python can be used to create 2D and 3D games, as well as game engines and
scripting. It has many libraries and modules that support game development, such as pygame, panda3D,
cocos2D, and PyOpenGL.
Desktop GUI Development: Python can be used to create graphical user interfaces for desktop
applications. It has many libraries and frameworks that provide GUI components, such as Tkinter,
wxPython, PyQt, PySide, PyGUI, and Kivy.
Enterprise/Business Applications: Python can be used to develop enterprise-level and business
applications that are scalable, extensible, and readable. It has many libraries and frameworks that
support enterprise development, such as Odoo, Tryton, SCons, Buildbot, Roundup, and Trac.
Educational Purposes: Python can be used to teach and learn programming, as well as to develop
educational resources and software. It has a simple syntax, a beginner-friendly nature, and a wide range
of applications. It also has libraries and frameworks that support education, such as Software Carpentry,
IPython, and Jupyter.
Database Access: Python can be used to access and manipulate data from various databases, such as
SQL, NoSQL, and cloud databases. It has many libraries and modules that provide database
connectivity, such as SQLite, MySQL, PostgreSQL, MongoDB, and SQLAlchemy.
Network Programming: Python can be used to create network applications, such as web servers, email
clients, FTP clients, and socket servers. It has many libraries and modules that support network
programming, such as socket, requests, urllib, twisted and, feedparser.
Chapter 2
LITERATURE SURVEY
2.1 Related Work
1. Title: Book Recommendation System with TensorFlow
Author: Anandaraj A, Yeshwanth Ram P, Sri Ram Kumar K, Revanth. M, Praveen R
Abstract:
This paper proposes a solution for recommending books to customers using the internet tool. The
internet tool allows the system to collect and analyze the customer's preferences and feedback. The
system can quickly and easily perform online recommendation filtering, which is the latest technique for
recommendation. The system filters, ranks, and delivers the most relevant books to the customers. The
system helps the websites to sell more books and increase their profit. The system uses the ratings of
each customer to understand their opinions on the books. The system overcomes the challenge of
implementing Content-Based Collaborative Filtering, which is a difficult task to combine.
Recommender systems have to filter, prioritize, and deliver relevant information to customers. This
paper proposes a solution using TensorFlow, a framework for building machine learning models.
TensorFlow can enhance the collaborative filtering process by adding more features and capabilities.
The system uses TensorFlow techniques to enhance the collaborative filtering process.
Disadvantages:
The Drawback here is that it does not compare its results with other existing recommender systems or
provide any evaluation metrics such as precision, recall, or F-score. Therefore, it is hard to assess the
performance and effectiveness of their proposed method.
2. Title: Cloud-Based Collaborative Filtering Algorithm For Library Book
Recommendation System
Author: Anoop A, N Ayush Ubale
Abstract:
A library book recommendation system is a system that helps libraries to manage their books more
efficiently. It is a website that allows the admin to create a system that can store and access books from
the database. The system uses a collaborative filtering algorithm to categorize the books and recommend
the best-rated (5-star rating) books to the user. The user can log in to their account using a password that
is sent to their valid email address. The user can then update their profile and view the books by subject
Each category shows one or more of the best-rated books to the user, so they can find the books they are
interested in more easily. The user can also chat with other users online to get suggestions about the
books. They can also request to borrow and return the books from the admin, who will deliver the books
to their home. The user can also rate and review the books they have borrowed. The system is free and
reliable and offers home delivery of books by requesting to borrow them.
Disadvantages:
The paper does not address the limitations of accuracy as a performance metric for classification
problems. Accuracy is not a good metric for classification problems because it does not account for the
nature or frequency of errors. Accuracy can be misleading when the data is imbalanced or the costs of
different errors are unequal. Other metrics are more sensitive to these issues, such as precision, recall,
F1-score, or ROC curve.
Abstract:
A recommender system is a type of internet tool that helps users find what they want on the web based
on their preferences. Recommender systems are very important for e-commerce websites because they
help users choose the right products. A good recommendation process can also increase sales and
customer loyalty. However, some existing methods may collect irrelevant data and make the users
unhappy or dissatisfied. This paper gives a general overview of the recommender systems used in the
online book shopping domain. It also proposes a simple and easy system for book recommendations that
can help readers find the next book they want to read. The paper focuses on the information analysis
challenge for the administration recommendation system, which deals with network resources that are
connected and growing fast. The paper also presents the overall architecture of the proposed system and
its implementation with a model design.
Disadvantages:
This paper does not represent the diverse tastes and ratings of all book readers, as it may favor certain
genres, authors, or languages. It may also have many gaps in the ratings, tags, or genres, which can
make the system less accurate and prone to cold start problems. Information might too large or complex
to handle efficiently, or too dynamic to keep up with. The data may pose privacy risks, as it may reveal
personal information about the users or be exposed to attacks or manipulation by malicious users.
Abstract:
To foster user engagement, internet platforms often tailor content suggestions to individual preferences.
The crux of this personalization lies in recommendation systems, which craft a lineup of content by
analyzing user interactions. Notably, user-provided ratings serve as a crucial dataset for discerning
favored content. This study delves into the mechanics of book recommendations, employing a
collaborative filtering approach that incorporates these ratings. An experiment conducted on a randomly
chosen user’s past behavior yielded a quintet of book suggestions with a 59% accuracy rate. This
research contributes valuable insights for the advancement of Binus University’s content
recommendation system within its corporate learning framework.
Disadvantages:
The embedding model achieved an accuracy of 59%, which indicates there is room for improvement in
the recommendation system's performance. The paper mentions that the embedding model is a basic
architecture, which may limit its ability to capture complex patterns in user preferences compared to
more advanced models.
Chapter 3
REQUIREMENT SPECIFICATIONS
System requirement specification (SRS) is a document that describes the features and behavior of a software or
system. It defines what the software or system should do and how it should perform, based on the needs and
expectations of the stakeholders (users, customers, developers, etc.). It includes both functional and non-
functional requirements, as well as any constraints or assumptions that affect the design and development of the
software or system.
System Requirement Specification (SRS) is a central report, which frames the establishment of the product
advancement process. It records the necessities of a framework as well as has a depiction of its significant
highlight. An SRS is essentially an association's seeing (in composing) of a client or potential customer's
framework necessities and conditions at a specific point in time (generally) before any genuine configuration or
improvement work. It's a two-way protection approach that guarantees that both the customer and the
association comprehend the alternate's necessities from that viewpoint at a given point in time.
An SRS serves as a blueprint and a reference for the software or system, guiding the design, validation, and
communication processes. It helps to ensure that the software or system meets the requirements and satisfies the
stakeholders. An SRS typically follows a standard format and structure, such as the IEEE 830-1998, which
covers topics such as introduction, overall description, specific requirements, appendices, and index. An SRS
should be clear, concise, consistent, complete, correct, and verifiable.
The SRS talks about the item however not the venture that created it, consequently the SRS serves as a premise
for later improvement of the completed item. The SRS may need to be changed, however, it does give an
establishment to proceed with the creation assessment. In straightforward words, programming necessity
determination is the beginning stage of the product improvement action.
The SRS means deciphering the thoughts in the brains of the customers – the information, into a formal archive
the yield of the prerequisite stage. Subsequently, the yield of the stage is situated of formally determined
necessities, which ideally are finished and steady, while the data has none of these properties. A requirements
specification document outlines the features, functionalities, and constraints of a software project. It typically
includes user needs, system behavior, and acceptance criteria. Clear requirements help guide development and
ensure stakeholders' expectations are met.
3.2.1 PyCharm
PyCharm is developed by JetBrains, is a renowned Integrated Development Environment (IDE) specifically
tailored for Python programming. Offering a plethora of features, it simplifies and enhances the development
process for Python applications. With intelligent code assistance, including syntax highlighting, code
completion, and error highlighting, PyCharm empowers developers to write clean and efficient code. The IDE
also incorporates a robust set of integrated tools for testing, profiling, and debugging, supporting popular testing
frameworks such as pytest and unittest.
3.2.2 Python
Python is a dynamic, interpreted (bytecode-compiled) language. There are no type declarations of variables,
parameters, functions, or methods in source code. This makes the code short and flexible, and you lose the
compile-time type checking of the source code. Python tracks the types of all values at runtime and flags code
that does not make sense as it runs. Python is a modern computer programing language. It bears some
similarities to Fortran, one of the earliest programing languages, but it is much more than Fortran. Python
allows you to use variables without declaring them (i.e., it determines types implicitly), and it relies on SMART
RESCUE AND SURVEILANCE ROBOT USING AI AND ML indentation as a control structure. Python was
developed by Guido Van Rossum, and it is free software. But Python is also free in other important ways, for
example you are free to copy it as many times as u like, and free to study the source code, and make changes.
3.2.4 Flask
Flask is a Python web framework that allows you to create and deploy web applications with ease. It is based on
the Werkzeug WSGI toolkit and the Jinja2 template engine, which provide low-level and high-level
functionality respectively. Flask is designed to be minimal and flexible, letting you choose the components and
extensions that suit your needs. Flask supports various features, such as routing, templating, testing, debugging,
error handling, and deployment Flask is widely used for developing web applications, such as blogs, APIs,
dashboards, and more.
3.2.5 Pickle
Pickle is a Python module that allows you to serialize and deserialize Python objects into a binary format.
Serialization is the process of converting an object into a stream of bytes that can be stored or transmitted.
Deserialization is the reverse process of reconstructing an object from a stream of bytes. Pickle can handle
various types of Python objects, such as lists, dictionaries, functions, classes, and more. Pickle can be useful for
saving the state of an object, transferring data between processes, or persistently storing data. You can use the
pickle.dumps() function to serialize an object into a bytes object, and the pickle.loads() function to deserialize a
bytes object into an object¹. You can also use the pickle. dump() and pickle.load() functions to write and read
pickled objects to and from a file.
Performance: This includes factors like response time, latency, and throughput. A good voice assistant
should provide quick and near-instantaneous responses to user queries or commands while handling
multiple user interactions without significant delays.
Scalability: The system should be scalable to accommodate varying user loads and adapt to increased
demand without compromising performance. It should efficiently handle a growing number of users
interacting with the voice assistant simultaneously.
Reliability: It involves the system's ability to operate consistently and predictably without failure. The
voice assistant should maintain its functionality even under stressful conditions, minimizing downtime
and ensuring continuous availability.
Security: Protecting user data, maintaining privacy, and preventing unauthorized access are crucial.
Encryption, secure authentication mechanisms, and adherence to data privacy regulations are vital
aspects of non-functional requirements related to security.
Accuracy and Naturalness: The generative AI integrated into the voice assistant should generate
responses that are accurate, coherent, and contextually relevant. Natural language generation should
mimic human-like conversational patterns to enhance user engagement.
Adaptability and Customizability: The system should adapt to user preferences, allowing
personalization of interactions and customization based on individual user needs or environments.
Resource Utilization: Efficient use of computational resources like memory, CPU, and bandwidth is
essential. Optimizing resource consumption ensures the system operates effectively without
unnecessary overhead.
Compatibility and Interoperability: Compatibility with different devices, operating systems, and
platforms ensures a broader user base can access and use the voice assistant. Interoperability allows
seamless integration with other systems or applications.
Usability and User Experience: A user-friendly interface, intuitive interactions, and minimal
cognitive load contribute to a positive user experience. The voice assistant should be easy to use and
navigate, catering to users of varying technical abilities.
Chapter 4
SYSTEM ARCHITECTURE
4.1 System Analysis
System development is an organized process encompassing stages like planning, analysis, design,
implementation, and maintenance. System analysis involves gathering and interpreting data, pinpointing
issues, and breaking down a system into its elements to understand its goals. It's a problem-solving
approach that enhances the system's performance and ensures each component functions effectively to
fulfill its intended role. The analysis delineates the system's required operations. Meanwhile, system design
entails devising a new business system or revamping an existing one by outlining its components or
modules to meet specific needs. Before this, a comprehensive understanding of the current system is
crucial, as well as determining the optimal use of computers for effective operation. System design is
centered on achieving the system's goals.
The software architecture of a book recommendation system is designed to provide personalized book
suggestions to users based on their preferences and reading history. At its core, the system comprises several
interconnected modules that work in tandem to deliver accurate and relevant recommendations. The key
components in the software architecture of a book recommendation system using a User-Based Collaborative
Filtering (UBCF) approach are:
User Preferences: Collecting and analyzing user preferences and ratings for books. User preferences in
book recommendation systems are crucial for providing personalized and relevant suggestions. Here are
the key points regarding user preferences: Content-Based Filtering, Collaborative-Based Filtering,
Hybrid Filtering, and User Interaction. These methods aim to align recommendations with individual
user interests, enhancing the reading experience.
Similarity Measures: Calculating similarity between users based on their preferences to identify like-
minded readers. It computes the similarity between users based on their ratings and preferences.
Collaborative Filtering: Using UBCF to predict items (books) that a user might like based on ratings
given by similar users.
Data Management: Handling the storage, retrieval, and analysis of user data and book information. A
robust database stores and organizes the collected data, ensuring quick retrieval and efficient handling of
large volumes of information. It typically includes tables for users, books, authors, genres, and ratings.
Feedback Loop: Incorporating user feedback to refine and improve the recommendation process. An
essential aspect of the architecture is the feedback loop, which allows the system to learn from user
interactions. As users engage with the recommendations, their responses are fed back into the system to
refine future suggestions.
Security and Privacy: Ensuring user data protection is a critical component, with measures in place to
safeguard personal information and comply with privacy regulations.
Item Profile Module: Similar to the user profile, this module keeps track of the attributes of the books,
such as genre, author, publication year, and other metadata that might influence a user's preference.
Ratings Matrix Module: Here, the system creates a matrix to represent the ratings given by users to
different books. This matrix is sparse as not all users rate all books, but it's essential for finding correlations
between users.
Similarity Computation Module: This module calculates the similarity between users based on their
ratings and preferences. Common algorithms used here include Pearson correlation, cosine similarity, and
Euclidean distance.
Neighborhood Formation Module: After computing similarities, this module selects a 'neighborhood' of
users with similar tastes to a given user. The size of this neighborhood can affect the quality of
recommendations.
Recommendation Generation Module: Leveraging the neighborhood, this module predicts the ratings a
user might give to unrated books and generates a list of recommendations. Predictions are usually based on
the weighted average of ratings from similar users.
Evaluation Module: This module assesses the performance of the recommendation system, often using
metrics like Mean Absolute Error (MAE) or Root Mean Squared Error (RMSE), to ensure the quality of
recommendations.
Feedback Module: Finally, this module captures user feedback on the recommendations provided, which
can be explicit (through ratings) or implicit (through click-through rates), to refine and improve the
recommendation process.
This is a book recommendation system, where readers with overlapping reading preferences are connected.
The system would then suggest books that one reader enjoys to the other, using visual elements like book
icons and connecting lines to represent the shared likes and recommendations. It’s a visual metaphor for
how book recommendation systems can predict and cater to reader preferences based on commonalities in
their reading history.
Chapter 5
SYSTEM IMPLEMENTATION
> Gather data on user preferences, such as books they’ve read, ratings, and other relevant information.
> Clean and preprocess the data by handling missing values, removing duplicates, and ensuring consistency.
> Construct a matrix where rows represent users and columns represent items (in this case, books).
> Populate the matrix with user-item interactions (e.g., ratings, likes, or purchase history).
> Decompose the user-item matrix into latent factors (user and item embeddings).
> Use these embeddings to predict missing ratings or recommend items.
> Consider book features (e.g., genre, author, publication year) to recommend similar books.
> If a user likes a mystery novel, recommend other mystery novels.
> Combine collaborative filtering and content-based methods for better recommendations.
> Weighted averages or ensemble techniques can be used.
> Assess recommendation quality using metrics like Mean Absolute Error (MAE), Root Mean Squared
Error (RMSE), or precision/recall.
> Split data into training and test sets for evaluation.
The Success of a Recommendation System depends on the quality of data, choice of algorithms, and thorough
evaluation. Each step involves careful design and tuning to create an effective system that enhances user
experiences.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Book Recommender System</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
crossorigin="anonymous">
</head>
<style>
a, u {
text-decoration: none;
}
a:hover {
background-color: #c5805c;
}
.card{
margin-bottom: 30px;
width: 250px;
box-shadow: 0 15px 25px rgba(129, 124, 124, 0.2);
height: 300px;
display: flow-root;
border-radius: 5px;
backdrop-filter: blur(100px);
background-color: rgba(255, 255, 255,
0.2); text-align: center;
}
.background{
height: 150px;
margin-bottom:30px;
margin-right: auto;
margin-left: auto;
}
.book-name{
color:rgb(0, 0, 0);
text-shadow: 1.5px 1px #ffffff;
font-family:Verdana;
}
.book-details{
color: #000000;
text-shadow: 1px 1px #a9a9a9;
font-family:Bahnschrift;
}
.page{
border:none;
display:inline-flex;
background-color: #b9b9b9;
border-radius:5px;
color: #030303;
position: relative;
text-shadow: 1px 1px #e1e1e1;
margin-bottom: 10px;
}
ul li{
font-family: "Times New Roman";
font-size: 20px;
}
.navbar-brand{
font-size: 40px;
text-align: center;
text-shadow: 3px 3px #000000;
color: #ffffff;
position: relative;
background-size: cover;
font-family: "Times New Roman";
background-image: url('https://th.bing.com/th/id/OIP.VvYd74xJf-
55NBR6EcOzyQHaE8?rs=1&pid=ImgDetMain') height:100% width:100% opacity:60%;
background-repeat:repeat;
}
img{ floa
t: left;
width: 100px;
height: 100px;
position:absolute;
background-repeat: no-repeat, repeat;
}
.text-top50{
color: #d3d3d3;
text-shadow: 3px 3px #2c2c2c;
position: relative;
text-align: center;
}
</style>
<body style="background: radial-gradient(circle, rgb(98,76,95) 0%, rgb(53,84,79) 100%);" >
<img src="https://c.wallhere.com/photos/c4/8c/books_library_bokeh_depth_of_field-74960.jpg!d"
style="position:fixed;width:100%; display:flex;height: 100%;background-position: center;background-size:
cover;">
<nav class="nav-bar">
<p class="navbar-brand"><strong>MY BOOK RECOMMENDER</strong</p>
<ul class="nav navbar-nav">
<li style="display: inline;margin:10px;padding:10px"><a class="page" href="/">Home</a></li>
<li style="display: inline;margin:10px;padding:10px"><a class="page"
href="/recommend">Recommend</a></li>
<li style="display: inline;margin:10px;padding:10px"><a class="page">Contact</a></li>
</ul>
</nav>
<div class="container">
<div class="row">
<div class="col-12" >
<h1 class="text-top50" style="text-align: center; font-family:'Times New Roman', Times,
serif"><strong>Top 50 Popular Books</strong></h1>
</div>
{% for i in range(book_name|length) %}
<div class="col-3" style="margin:50px">
<div class="background">
<div class="card" style="width:380px ;height:270px;" >
<div class="card-body">
<img class="card-img-top" src="{{ image[i] }}" style="width:150px;height:240px;
position:relative;margin-right: 10px">
<h6 class="book-name"><strong>{{ book_name[i] }}</strong></h6>
<p class="book-details"> {{ author[i] }}</p>
<p class="book-details"> Votes - {{ votes[i] }}</p>
<p class="book-details">Rating - {{ rating[i] }}</p>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</body>
</html>
.background{
height: 150px;
margin-bottom:30px;
margin-right: auto;
margin-left: auto;
}
.book-
name{ color:black
;
text-shadow: 1px 1px #ffffff;
font-family:Verdana,serif;
}
.book-details{
color: #000000;
text-shadow: 1px 1px #aedade;
font-family:'Bahnschrift,serif';
}
.page{
border:none;
display:inline-flex;
background-color: #b9b9b9;
border-radius:5px;
color: #030303;
position: relative;
text-shadow: 1px 1px #e1e1e1;
margin-bottom: 10px;
}
ul li{
font-family: "Times New
Roman",serif; font-size: 20px;
}
.navbar-brand{
font-size: 40px;
text-align: center;
text-shadow: 3px 3px #3f3030;
color: #ffffff;
position: relative;
background-size: cover;
font-family: "Times New
Roman",serif; background-
repeat:repeat;
}
img{ floa
t: left;
width: 100px;
height: 100px;
position:absolute;
background-repeat: no-repeat, repeat;
}
.text-top50{
color: #d3d3d3;
text-shadow: 3px 3px #2c2c2c;
position: relative;
text-align: center;
}
</style>
<body style="background: radial-gradient(circle, rgb(98,76,95) 0%, rgb(53,84,79) 100%);" >
<img src="https://c.wallhere.com/photos/c4/8c/books_library_bokeh_depth_of_field-74960.jpg!d"
style="position:fixed;width:100%; display:flex;height: 100%;background-position: center;background-size:
cover;" alt="alternateimage">
<nav class="nav-bar">
<p class="navbar-brand"><strong>MY BOOK RECOMMENDER</strong</p>
<ul class="nav navbar-nav">
<li style="display: inline;margin:10px;padding:10px"><a class="page" href="/">Home</a></li>
<li style="display: inline;margin:10px;padding:10px"><a class="page"
href="/recommend">Recommend</a></li>
<li style="display: inline;margin:10px;padding:10px"><a class="page">Contact</a></li>
</ul>
</nav>
<div class="container">
<div class="row">
pt = pickle.load(open('pt.pkl', 'rb'))
books = pickle.load(open('books.pkl', 'rb'))
similarity_score = pickle.load(open('similarity_score.pkl', 'rb'))
@app.route('/')
def index():
return render_template("index.html",
book_name=popular_df['Book-Title'].to_list(),
author=popular_df['Book-Author'].to_list(),
image=popular_df['Image-URL-M'].to_list(),
votes=popular_df['num-ratings'].to_list(),
rating=popular_df['avg-rating'].to_list()
)
@app.route('/recommend')
def recommend_ui():
return render_template('recommend.html')
@app.route('/recommend_books', methods=['GET','POST'])
def recommend():
user_input = request.form.get('user_input')
index = np.where(pt.index == user_input)[0][0]
similar_items = sorted(list(enumerate(similarity_score[index])), key=lambda x: x[1], reverse=True)[1:5]
data = []
for i in similar_items:
item = []
temp_df = books[books['Book-Title'] == pt.index[i[0]]]
item.extend(temp_df.drop_duplicates('Book-Title')['Book-Title'].to_list())
item.extend(temp_df.drop_duplicates('Book-Title')['Book-Author'].to_list())
item.extend(temp_df.drop_duplicates('Book-Title')['Image-URL-M'].to_list())
data.append(item)
print(data)
return render_template("recommend.html", data=data)
Chapter 6
Chapter 7
RESULTS
The conclusion of the book recommendation system using a user-based collaborative filtering approach is that it
is a personalized method, relying on the similarity between users’ interactions with items. It identifies users
with similar profiles and recommends items popular among these users. While this method is sensitive to
recorded interactions and can provide highly personalized recommendations, it requires significant
computational power due to the large number of users. Moreover, the user preferences may change over time,
making the system less deterministic. Despite these challenges, the user-based collaborative filtering approach
remains a valuable tool for providing tailored book recommendations. Given more information regarding the
books dataset, namely features like Genre, Description, etc., we could implement a content-filtering based
recommendation system and compare the results with the existing collaborative-filtering based system. We
would like to explore various clustering approaches for clustering the users based on Age, Location, etc., and
then implement voting algorithms to recommend items to the user depending on the cluster into which it
belongs.
Page 47
REFERENCES
[1] R. C K and K. C. Srikantaiah, "Similarity-Based Collaborative Filtering Model for Movie
Recommendation Systems," 2021 5th International Journal on Intelligent Computing and Control
Systems (2021).
[2] Huaxuan Zhao, Hongchen Wu, Jingzhi Li, Huaxiang Zhang And Xinjun Wang. "A High-Accuracy and
Dynamic Scheme for Real-Time Book Recommendation System". SPECIAL SECTION ON Advanced
Data Mining Methods For Social Computing, January 2020.
[3] Anoop A, N Ayush Ubale. "Cloud Based Collaborative Filtering Algorithm For Library Book
Recommendation System". Proceedings of the Third International Journal on Smart Systems and
Inventive Technology (2020).
[4] Huayong Liu, Nianlai Jiao. "A Hybrid Book Recommendation Algorithm Based on Context awareness
and Social Network". In 3rd International Journal on Advanced Electronic Materials, Computers and
Software Engineering (AEMCSE 2020).
[5] Kitti Puritat, Kannikar Intawong. "Development of an Open Source Automated Library System with
Book Recommendation System for Small Libraries". In International Journal on Digital Arts, Media and
Technology with ECTI Northern Section Journal on Electrical, Electronics, Computer and
Telecommunications Engineering (ECTI DAMT & NCON 2020).
[6] JiabeiLi, TianweiXu, Juxiang Zhou. "A personalized Recommendation Algorithm for College Books
based on User Interest". In IEEE 2nd International Journal on Computer Science and Educational
Informatization (CSEI 2020).
[7] M. Li, H. Wu, and H. Zhang, ‘‘Matrix factorization for personalized recommendation with implicit
feedback and temporal information in social e-commerce networks,’’ IEEE Access (2019).
[8] Murthy, K.V.S.S.R., &Satyanarayana, K.V.V ,”Intusion detection mechanism with machine learning
process “ International Journal of Engineering and Technology(2018).
[9] Narsinga rao, M.R.,Venkatesh Prasad ,V.,Sai Teja,P.,Zindavali,M. , Chandra Reddy, O,” A survey on
Prevention of Overfitting in convolutional neural networks using machine learning techniques”
International Journal of Engineering and Technology(2018).
Page 48