NMLS - 3. Recommender Systems - Collaborative Filtering - Introductory Machine Learning

 

In 2022 I started the new  Machine Learning Specialization by Andrew NG.

I completed it's first two courses in 2022. I'll share the jupyter notebooks from this specialization soon.

Now, in 2023 when I am finally free from my M1, I am going to complete the specialization. Here is the third Assignment of course 3 (last course) on Recommender Systems.

 

We were given a dataset which contained 'nu' users and 'nm' movies. The ratings that each user gave to various movies were present in the dataset.

The task was:

We have a new user who has not yet rated a lot of movies.

We have have to recommended him movies based on his previous ratings.

 

Procedure:

The cost function was implemented using For Loop & then without any loop (Vectorized Implementation)

A list of movie ratings for a new user was created and was added to the training data

The rows(movies) were normalized by taking average of each row for non-zero values and then subtracting each value from the row

A custom tensorflow training loop was created:

  • The variables which we wanted to train were declared
  • Adam Optimizer was instantiated
  • Number of iterations were fixed
  • Parameters Matrix, Features Matrix, Bais Matrix, Normalized Dataset, Binary Indicator Matrix and lambda (regularization parameter) were passed to cost function
  • Gradient tape was used to automatically retrieve the derivatives
  • One step of gradient descent was run

The loop was repeated for 200 iterations

Predictions on all of the data were made

Predictions on the new user were retrieved separately.

Predictions with highest values(highest rating predictions) could be recommended to the user.


Relevant  github link (my github repo)

Relevant  video explanation (by me in Urdu-langauge)

Comments

Popular posts from this blog

Ai SDK ui - 1 - Learning AI SDK UI with Next.js

NMLS - 1. Clustering - Kmeans - Unsupervised Learning - Introductory Machine Learning