# Cost function for binary application - regularization terms - what is k?

I know that in the course example superscript (j) is the User, and superscript (i) is the Movie.

But I’m not sure how to interpret what subscript k represents in the regularization terms.

Can someone help me what subscript “k” refers to?

Thanks very much.

Hi @MattF,

k counts from 1 to n, right? So, each user vector or each movie vector is a vector of n numbers. If you call it n features, then k means the k-th feature.

Cheers,
Raymond

Hi rmwkwok

You’re right, Andrew tells us that “n” refers to the number of features. In this case x1 and x2.

Given this table of movies, users, and features, I see that the first regularization term refers to each feature (x sub k) of each movie (n sub m).

For the user parameters w, I still don’t quite get it. The outer sum is over each User (Alice, Bob, Carol, Dave) but the inner sum refers to which element?

x sub k makes sense to me since n is the number of features.

But I can’t yet make sense of w sub k.

I believe there should be a value w per user. Is there also a value w per feature?

Or are we saying that we treat each user as a feature also?

I must be missing something.

Hi @MattF,

The lecture showed a table for movies, as you have quoted, but just didn’t show explicitly a table for users.

In your quote, there are two features for each movie, namely `x_1` and `x_2`, or naively assumed to be `romance` and `action` respectively. Then, you might assume there is a hidden table for users, where there are also two features for each user, namely `w_1` and `w_2`, or as naively assumed to be `weight for romance` and `weight for action` respectively.

Mathematically speaking, for the dot product to work, there must be the same number of “features” for both users and movies, in other words, they have to share the same value of n which is the case if you look at the cost function again. This implies that if there are n features for movies, there has to be also n features for users, or you might say there has to be n weights for users if calling it “weight” sounds any more reasonable than calling it “feature”.

Since dot product actually multiplies the first feature of movie to the first feature of user, and the second movie’s feature to the second user’s, and so on, it is quite noticable of how features of users and features of movies are one-one paired up. Since they are paired up, it is reasonable to interpret them to share something in common, and that is why if `x_1` is naively interpreted as `romance`, I would interpret `w_1` as `weight for romance` but not weight for anything else.

Cheers,
Raymond

The idea that there’s a separate users table and that this table must have the same shape as the features helps a lot. I’m still working on fully understanding the whole thing but this is very good. Thanks very much.