Skip to content

In this project we used a k-nearest neighbors algorithm (KNN) to recommend a book based on your previous book prefrecnces.

Notifications You must be signed in to change notification settings

AHMEDSANA/Book-Recommendation-System-using-KNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

KNN

K-nearest neighbors (KNN) is a simple, yet powerful machine learning algorithm used for classification and regression tasks. It works by finding the "k" nearest data points in the training set to a given test point and using their labels or values to make predictions. In classification, the majority class among the nearest neighbors is assigned to the test point, while in regression, the average or median value of the nearest neighbors is used. KNN is a non-parametric algorithm, meaning it does not make any assumptions about the underlying data distribution.

Book Recommendation system using KNN

Step 1: Collect data on user ratings of books: This could be done by asking users to rate books on a scale of 1 to 5, or by collecting data on books that users have purchased or borrowed from libraries.

Step 2: Choose a similarity metric to measure the similarity between books: This could be done by counting the number of common authors, the number of common genres, or the average rating of the books.

Step 3: Choose a value for k: This is the number of most similar books that will be recommended to each user. A higher value of k will result in more recommendations, but it may also result in less accurate recommendations.

Step 4: Find the k most similar books to each user: This can be done using a variety of algorithms, such as the KNN algorithm.

Step 5: Recommend the books to the users: This can be done by displaying a list of the recommended books to the users, or by sending them emails with recommendations.

Running this code

To run this code just copy the code or download the notebook and run it. The dataset link is already given in the notebook which will be downloaded during execution of the code.