8/15/2023 0 Comments Fiction book suggester![]() ![]() # Matching the genre with the dataset and reset the indexĭata.reset_index(level = 0, inplace = True) It takes book title and genre as an f recommend(title, genre): # Function for recommending books based on Book title. Define a function that takes the book title and genre as input and returns the top five similar recommended books based on the title and description.Calculate the similarity between all the books using cosine similarity.The model recommends a similar book based on title and description. We are building two recommendation engines, one with a book title and another one with a book description.Convert each book title and description into vectors using TF-IDF and bigram.We are going to build two recommendation engines using the book titles and descriptions. # Applying all the functions in description and storing as a cleaned_descĭf = df.apply(_removeNonAscii)ĭf = df.cleaned_desc.apply(func = make_lower_case)ĭf = df.cleaned_desc.apply(func = remove_stop_words)ĭf = df.cleaned_desc.apply(func=remove_punctuation)ĭf = df.cleaned_desc.apply(func=remove_html) # Function for removing NonAscii characters I have taken only three genres like business, non-fiction and cooking for this problem Rating -> Book rating given by the user.Total 3592 books details available in our dataset. How do we find whether the given book is similar or dissimilar? A similarity measure was used to find this.įrom import linear_kernelįrom sklearn.feature_extraction.text import CountVectorizerįrom sklearn.feature_extraction.text import TfidfVectorizerįrom nltk.tokenize import RegexpTokenizer We need to find similar books to a given book and then recommend those similar books to the user. We are going to build two recommendation systems by using a book title and book description. Hence, we have used a simple content-based recommendation system. (Sidney Sheldon novels belong to the non-fiction genre).Īs I mentioned above, we are using data and don’t have user reading history. ![]() It also considers the user's previous history in order to recommend a similar product.Įxample: If a user likes the novel “Tell Me Your Dreams” by Sidney Sheldon, then the recommender system recommends the user to read other Sidney Sheldon novels, or it recommends a novel with the genre “non-fiction”. It identifies the similarity between the products based on their descriptions. This recommender system recommends products or items based on their description or features. Content-based recommendation systems recommend items to a user by using the similarity of items. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |