From f5faa2ef095f035110f83e17da0b35d3a34d6b97 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sat, 17 Feb 2024 19:52:53 -0700 Subject: bump --- docs/posts/2022-05-21-Similar-Movies-Recommender.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs/posts/2022-05-21-Similar-Movies-Recommender.html') diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index e8b9a12..c7f3b3a 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -26,7 +26,7 @@ - + @@ -35,6 +35,7 @@ home | about/links | posts | +3D designs | RSS Feed | -- cgit v1.2.3 From f6d2141a480dd6b5b8ee0e48d43bb64773232791 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 26 Mar 2024 23:38:14 -0600 Subject: add header ids --- .../2022-05-21-Similar-Movies-Recommender.html | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'docs/posts/2022-05-21-Similar-Movies-Recommender.html') diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index c7f3b3a..717513f 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -6,13 +6,13 @@ - Building a Similar Movies Recommendation System + id="building-a-similar-movies-recommendation-system">Building a Similar Movies Recommendation System - - + Building a Similar Movies Recommendation System" /> + Building a Similar Movies Recommendation System" /> @@ -44,21 +44,21 @@
-

Building a Similar Movies Recommendation System

+

Building a Similar Movies Recommendation System

-

Why?

+

Why?

I recently came across a movie/tv-show recommender, couchmoney.tv. I loved it. I decided that I wanted to build something similar, so I could tinker with it as much as I wanted.

I also wanted a recommendation system I could use via a REST API. Although I have not included that part in this post, I did eventually create it.

-

How?

+

How?

By measuring the cosine of the angle between two vectors, you can get a value in the range [0,1] with 0 meaning no similarity. Now, if we find a way to represent information about movies as a vector, we can use cosine similarity as a metric to find similar movies.

As we are recommending just based on the content of the movies, this is called a content based recommendation system.

-

Data Collection

+

Data Collection

Trakt exposes a nice API to search for movies/tv-shows. To access the API, you first need to get an API key (the Trakt ID you get when you create a new application).

@@ -140,7 +140,7 @@

In the end, I could have dropped the embeddings field from the table schema as I never got around to using it.

-

Scripting Time

+

Scripting Time

from database import *
@@ -243,7 +243,7 @@
 
 

Running this script took me approximately 3 hours, and resulted in an SQLite database of 141.5 MB

-

Embeddings!

+

Embeddings!

I did not want to put my poor Mac through the estimated 23 hours it would have taken to embed the sentences. I decided to use Google Colab instead.

@@ -308,7 +308,7 @@ As of writing this post, I did not include any other database except Trakt.

That's it!

-

Interacting with Vectors

+

Interacting with Vectors

We use the trakt_id for the movie as the ID for the vectors and upsert it into the index.

@@ -359,7 +359,7 @@ It is possible that this additional step of mapping could be avoided by storing
-

Testing it Out

+

Testing it Out

movie_name = "Now You See Me"
@@ -405,21 +405,21 @@ Spies (2015): A secret agent must perform a heist without time on his side
 
 

For now, I am happy with the recommendations.

-

Simple UI

+

Simple UI

The code for the flask app can be found on GitHub: navanchauhan/FlixRec or on my Gitea instance

I quickly whipped up a simple Flask App to deal with problems of multiple movies sharing the title, and typos in the search query.

-

Home Page

+

Home Page

Home Page

-

Handling Multiple Movies with Same Title

+

Handling Multiple Movies with Same Title

Multiple Movies with Same Title

-

Results Page

+

Results Page

Results Page

@@ -429,14 +429,14 @@ Spies (2015): A secret agent must perform a heist without time on his side

Test it out at https://flixrec.navan.dev

-

Current Limittations

+

Current Limittations

  • Does not work well with popular franchises
  • No Genre Filter
-

Future Addons

+

Future Addons

  • Include Cast Data -- cgit v1.2.3 From 9e620084e57378952c1a7f8e0a772ebebd18932b Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 20:35:09 -0600 Subject: quick fix --- docs/posts/2022-05-21-Similar-Movies-Recommender.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/posts/2022-05-21-Similar-Movies-Recommender.html') diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index 717513f..c1c103b 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -6,13 +6,13 @@ - id="building-a-similar-movies-recommendation-system">Building a Similar Movies Recommendation System + Building a Similar Movies Recommendation System - Building a Similar Movies Recommendation System" /> - Building a Similar Movies Recommendation System" /> + + -- cgit v1.2.3 From 01ff93c9c16867216f2d249664803860e1d6d5eb Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 22:49:40 -0600 Subject: generate new theme --- .../2022-05-21-Similar-Movies-Recommender.html | 55 +++++++++++++++------- 1 file changed, 37 insertions(+), 18 deletions(-) (limited to 'docs/posts/2022-05-21-Similar-Movies-Recommender.html') diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index c1c103b..bba6725 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -2,14 +2,26 @@ - + + + + + Building a Similar Movies Recommendation System + + + + + + + - Building a Similar Movies Recommendation System - @@ -29,21 +41,27 @@ - -
    -
    + + +
    -
    - +

    Building a Similar Movies Recommendation System

    Why?

    @@ -450,14 +468,15 @@ Spies (2015): A secret agent must perform a heist without time on his side
  • Filter based on popularity: The data already exists in the indexed database
+
If you have scrolled this far, consider subscribing to my mailing list here. You can subscribe to either a specific type of post you are interested in, or subscribe to everything with the "Everything" list.
-
+ -- cgit v1.2.3 From de19543d7fb44d343b052dc9b34ede78620c4a46 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 23:36:55 -0600 Subject: Generate --- docs/posts/2022-05-21-Similar-Movies-Recommender.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'docs/posts/2022-05-21-Similar-Movies-Recommender.html') diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index bba6725..e592257 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -46,7 +46,7 @@ + +
-- cgit v1.2.3 From a982ceab0b45609991179b3020a00260eed6f798 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Wed, 27 Mar 2024 23:45:59 -0600 Subject: css --- docs/posts/2022-05-21-Similar-Movies-Recommender.html | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/posts/2022-05-21-Similar-Movies-Recommender.html') diff --git a/docs/posts/2022-05-21-Similar-Movies-Recommender.html b/docs/posts/2022-05-21-Similar-Movies-Recommender.html index e592257..bc1ab08 100644 --- a/docs/posts/2022-05-21-Similar-Movies-Recommender.html +++ b/docs/posts/2022-05-21-Similar-Movies-Recommender.html @@ -5,6 +5,7 @@ + Building a Similar Movies Recommendation System -- cgit v1.2.3