<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chaya Gowda on Medium]]></title>
        <description><![CDATA[Stories by Chaya Gowda on Medium]]></description>
        <link>https://medium.com/@chayagowda72?source=rss-98a566c47aa1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XPMi7m500DMxAuJy</url>
            <title>Stories by Chaya Gowda on Medium</title>
            <link>https://medium.com/@chayagowda72?source=rss-98a566c47aa1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 01:58:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chayagowda72/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[WHAT IS NLP BASED RECOMMENDATION SYSTEMS?]]></title>
            <link>https://medium.com/@chayagowda72/what-is-nlp-based-recommendation-systems-e87018efed71?source=rss-98a566c47aa1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e87018efed71</guid>
            <dc:creator><![CDATA[Chaya Gowda]]></dc:creator>
            <pubDate>Sun, 19 Feb 2023 05:28:41 GMT</pubDate>
            <atom:updated>2023-02-19T05:44:39.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hW-afGHcqxxvlB5xLBjt1g.png" /></figure><p><em>Image Source: Google</em></p><p>Hey<strong> </strong>you, are you also surprised how your social media platforms like Instagram, Facebook, twitter, LinkedIn etc pops up your recently searched and you favourite items?</p><p>I was too, that is what grabbed my attention to write this article. Let us first understand what is a recommendation system and then dig deeper into it.</p><p>When you hear the term recommendation you understand it is a suggestion that something is good or suitable for a particular purpose.</p><p>Table of Contents</p><p>1. What is recommendation system?</p><p>2. Types of recommendation system</p><p>3. Implementation</p><p>4. Pros and cons</p><p><strong>1.What is a recommendation system (RS)?</strong></p><p>A recommendation system in NLP (natural language processing) Is a system that suggests content or items to users based on their language-related preferences or behaviors. These systems have become a tool in helping users to make choices, especially in the present world where the customers are supposed to make choices from a large number of products and services on different platforms like e-commerce platforms such as amazon, flip kart, Myntra, Meesho and Entertainment platforms like YouTube, Netflix, Spotify etc and Job platforms like LinkedIn, Naukri.com etc. there are different kinds of RS — content-based filtering and collaborative filtering.</p><p>Now, lets look at the types</p><p><strong>2.Types of recommendation system</strong></p><p><strong>1.</strong> <strong>Content-based filtering</strong></p><p>These type of recommendation systems analyses the textual content of the documents and makes the recommendations bases on the similarity of their content. It means that if two documents have similar content then a user who likes one of the documents is considered likely to enjoy the other as well.</p><p>Movie recommendation system is one of the best examples for content-based RS, like we all know each movie has its own genre, based on the genre users are recommended similar genre movies. I am sure we all have come across this situation where we are recommended movies that are similar to our previous watch list.</p><p>Content based RS can be implemented as follows:</p><p>1. Data collection</p><p>2. Text pre-processing</p><p>3. Feature extraction</p><p>4. Similarity computation</p><p>5. Recommendation generation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*dcVBbnugdMymC4lR8PF2rA.png" /></figure><p>Image source — Google</p><p><strong>2.</strong> <strong>Collaborative filtering</strong></p><p>These type of recommendation systems analyses the user’s previous records and their behaviour and then recommend items to users based on the preferences of other similar users. The previous records between users and items are stored in “user-item interaction matrix”. Collaborative filtering helps users to explore new content that they may be interested in</p><p>To be more clear about collaborative filtering let me give you an example — if there are 3 people and “A”, “B” and “C” , all three of them likes chocolate milkshake ,but “B” and “C” also likes vanilla milkshake hence vanilla milkshake is recommended to “A” since all three of them liked chocolate milkshake.</p><p>Collaborative filtering can be implemented using a technique called “Latent Dirichlet Allocation(LDA)”. It is a topic modelling technique that identifies the hidden(latent) topic present in a text. It identifies the topics that are relevant to a user based on their previous interests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZB-SI_MUXYxVIECjch1uw.png" /></figure><p>Image source — Google</p><p><strong>3.Implementation</strong></p><p># code</p><p><strong>import</strong> numpy as np</p><p><strong>import</strong> pandas as pd</p><p><strong>import</strong> sklearn</p><p><strong>import</strong> matplotlib.pyplot as plt</p><p><strong>import</strong> seaborn as sns</p><p><strong>import</strong> warnings</p><p>warnings.simplefilter(action<strong>=</strong>&#39;ignore&#39;, category<strong>=</strong>FutureWarning)</p><p>ratings <strong>=</strong> pd.read_csv(&quot;<a href="https://s3-us-west-2.amazonaws.com/recommender-tutorial/ratings.csv">https://s3-us-west-2.amazonaws.com/recommender-tutorial/ratings.csv</a>&quot;)</p><p>ratings.head()</p><p>movies <strong>=</strong> pd.read_csv(&quot;<a href="https://s3-us-west-2.amazonaws.com/recommender-tutorial/movies.csv">https://s3-us-west-2.amazonaws.com/recommender-tutorial/movies.csv</a>&quot;)</p><p>movies.head()</p><p>n_ratings <strong>=</strong> len(ratings)</p><p>n_movies <strong>=</strong> len(ratings[&#39;movieId&#39;].unique())</p><p>n_users <strong>=</strong> len(ratings[&#39;userId&#39;].unique())</p><p><strong>print</strong>(f&quot;Number of ratings: {n_ratings}&quot;)</p><p><strong>print</strong>(f&quot;Number of unique movieId&#39;s: {n_movies}&quot;)</p><p><strong>print</strong>(f&quot;Number of unique users: {n_users}&quot;)</p><p><strong>print</strong>(f&quot;Average ratings per user: {round(n_ratings/n_users, 2)}&quot;)</p><p>print(f&quot;Average ratings per movie: {round(n_ratings/n_movies, 2)}&quot;)</p><p>user_freq <strong>=</strong> ratings[[&#39;userId&#39;, &#39;movieId&#39;]].groupby(&#39;userId&#39;).count().reset_index()</p><p>user_freq.columns <strong>=</strong> [&#39;userId&#39;, &#39;n_ratings&#39;]</p><p>user_freq.head()</p><p># Find Lowest and Highest rated movies:</p><p>mean_rating <strong>=</strong> ratings.groupby(‘movieId’)[[‘rating’]].mean()</p><p># Lowest rated movies</p><p>lowest_rated <strong>=</strong> mean_rating[‘rating’].idxmin()</p><p>movies.loc[movies[‘movieId’] <strong>==</strong> lowest_rated]</p><p># Highest rated movies</p><p>highest_rated <strong>=</strong> mean_rating[‘rating’].idxmax()</p><p>movies.loc[movies[‘movieId’] <strong>==</strong> highest_rated]</p><p># show number of people who rated movies rated movie highest</p><p>ratings[ratings[‘movieId’]<strong>==</strong>highest_rated]</p><p># show number of people who rated movies rated movie lowest</p><p>ratings[ratings[‘movieId’]<strong>==</strong>lowest_rated]</p><p>## the above movies has very low dataset. We will use bayesian average</p><p>movie_stats <strong>=</strong> ratings.groupby(‘movieId’)[[‘rating’]].agg([‘count’, ‘mean’])</p><p>movie_stats.columns <strong>=</strong> movie_stats.columns.droplevel()</p><p># Now, we create user-item matrix using scipy csr matrix</p><p><strong>from</strong> scipy.sparse <strong>import</strong> csr_matrix</p><p><strong>def</strong> create_matrix(df):</p><p>N <strong>=</strong> len(df[‘userId’].unique())</p><p>M <strong>=</strong> len(df[‘movieId’].unique())</p><p># Map Ids to indices</p><p>user_mapper <strong>=</strong> dict(zip(np.unique(df[“userId”]), list(range(N))))</p><p>movie_mapper <strong>=</strong> dict(zip(np.unique(df[“movieId”]), list(range(M))))</p><p># Map indices to IDs</p><p>user_inv_mapper <strong>=</strong> dict(zip(list(range(N)), np.unique(df[“userId”])))</p><p>movie_inv_mapper <strong>=</strong> dict(zip(list(range(M)), np.unique(df[“movieId”])))</p><p>user_index <strong>=</strong> [user_mapper[i] <strong>for</strong> i <strong>in</strong> df[‘userId’]]</p><p>movie_index <strong>=</strong> [movie_mapper[i] <strong>for</strong> i <strong>in</strong> df[‘movieId’]]</p><p>X <strong>=</strong> csr_matrix((df[“rating”], (movie_index, user_index)), shape<strong>=</strong>(M, N))</p><p><strong>return</strong> X, user_mapper, movie_mapper, user_inv_mapper, movie_inv_mapper</p><p>X, user_mapper, movie_mapper, user_inv_mapper, movie_inv_mapper <strong>=</strong> create_matrix(ratings)</p><p><strong>from</strong> sklearn.neighbors <strong>import</strong> NearestNeighbors</p><p>“””</p><p>Find similar movies using KNN</p><p>“””</p><p><strong>def</strong> find_similar_movies(movie_id, X, k, metric<strong>=</strong>’cosine’, show_distance<strong>=</strong>False):</p><p>neighbour_ids <strong>=</strong> []</p><p>movie_ind <strong>=</strong> movie_mapper[movie_id]</p><p>movie_vec <strong>=</strong> X[movie_ind]</p><p>k<strong>+=</strong>1</p><p>kNN <strong>=</strong> NearestNeighbors(n_neighbors<strong>=</strong>k, algorithm<strong>=</strong>”brute”, metric<strong>=</strong>metric)</p><p>kNN.fit(X)</p><p>movie_vec <strong>=</strong> movie_vec.reshape(1,<strong>-</strong>1)</p><p>neighbour <strong>=</strong> kNN.kneighbors(movie_vec, return_distance<strong>=</strong>show_distance)</p><p><strong>for</strong> i <strong>in</strong> range(0,k):</p><p>n <strong>=</strong> neighbour.item(i)</p><p>neighbour_ids.append(movie_inv_mapper[n])</p><p>neighbour_ids.pop(0)</p><p><strong>return</strong> neighbour_ids</p><p>movie_titles <strong>=</strong> dict(zip(movies[‘movieId’], movies[‘title’]))</p><p>movie_id <strong>=</strong> 3</p><p>similar_ids <strong>=</strong> find_similar_movies(movie_id, X, k<strong>=</strong>10)</p><p>movie_title <strong>=</strong> movie_titles[movie_id]</p><p>print(f”Since you watched {movie_title}”)</p><p><strong>for</strong> i <strong>in</strong> similar_ids:</p><p><strong>print</strong>(movie_titles[i])</p><p>OUTPUT:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*zxw9HDBj97z-PQWmkivIkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*wCpP6oDkf8ELjHY71Zqi0w.png" /></figure><p><a href="https://www.geeksforgeeks.org/recommendation-system-in-python/"><strong>https://www.geeksforgeeks.org/recommendation-system-in-python/</strong></a></p><p><strong>4.Pros and Cons of recommendation system</strong></p><p><strong>Pros</strong></p><p>1. Helps the users by recommending items of their choice</p><p>2. Different and new products can be introduced to the users</p><p>3. Helps in expanding the business</p><p>4. Helps in personalizing the content and suggestions based on the user’s interest</p><p>5. It is quick and efficient as it helps the users to find their needs quickly</p><p>6. Increases the user engagement and retention that leads in better user satisfaction and loyalty</p><p><strong>Cons</strong></p><p>1. New products or items cannot be recommended if the user has not purchased it</p><p>2. The previous data of the user is required</p><p>3. The context of the user’s request may not be understood sometimes which may lead to irrelevant recommendations</p><p>4. There are chances of lack of diversity, narrows the user’s interests</p><p><strong>REFERENCES</strong></p><p>1. <a href="https://medium.com/mlearning-ai/what-are-the-types-of-recommendation-systems-3487cbafa7c9">https://medium.com/mlearning-ai/what-are-the-types-of-recommendation-systems-3487cbafa7c9</a></p><p>2. <a href="https://recsys-nlp.readthedocs.io/_/downloads/en/latest/pdf/">https://recsys-nlp.readthedocs.io/_/downloads/en/latest/pdf/</a></p><p>3. <a href="https://medium.com/@armandj.olivares/building-nlp-content-based-recommender-systems-b104a709c042">https://medium.com/@armandj.olivares/building-nlp-content-based-recommender-systems-b104a709c042</a></p><p>4. <a href="https://medium.com/mlearning-ai/content-based-recommender-system-using-nlp-445ebb777c7a">https://medium.com/mlearning-ai/content-based-recommender-system-using-nlp-445ebb777c7a</a></p><p>5. <a href="https://www.analyticsvidhya.com/blog/2022/01/all-you-need-to-know-about-recommendation-systems/">https://www.analyticsvidhya.com/blog/2022/01/all-you-need-to-know-about-recommendation-systems/</a></p><p>6. <a href="https://www.upgrad.com/blog/recommendation-system-machine-learning/">https://www.upgrad.com/blog/recommendation-system-machine-learning/</a></p><p>7. <a href="https://chat.openai.com/chat/e1aab60a-139b-4a4d-8be8-7820f3cc642c">https://chat.openai.com/chat/e1aab60a-139b-4a4d-8be8-7820f3cc642c</a></p><p>8. <a href="https://chat.openai.com/chat/90522f2c-3125-43e8-a852-c2b55788d8c9">https://chat.openai.com/chat/90522f2c-3125-43e8-a852-c2b55788d8c9</a></p><p>9. <a href="https://www.geeksforgeeks.org/recommendation-system-in-python/">https://www.geeksforgeeks.org/recommendation-system-in-python/</a></p><p><strong>ABOUT THE AUTHOR</strong></p><p>Chaya Gowda –</p><p>I am a student currently pursuing my post-graduation in data analytics</p><p>and have a strong interest in the field of data science, machine learning, and artificial intelligence.</p><p>I hope you found this article helpful, if you did, please share it among your friends too.</p><p>“NEVER STOP LEARNING, BECAUSE LIFE NEVER STOPS TEACHING”</p><p><strong>Connect with me</strong></p><p>LinkedIn: <a href="https://www.linkedin.com/in/chaya-gowda-19a94218b/">https://www.linkedin.com/in/chaya-gowda-19a94218b/</a></p><p>Email id : <a href="/service/mailto:chayagowda72@gmail.com">chayagowda72@gmail.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e87018efed71" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>