Hello I am trying to make a content based movie recommendation system and one feature is genre of the movie. I will give an integer number to each genre randomly. However, some movies are of more than 1 genre. I will use tf-idf for weigthing these features. However, I am very confused that what to do when a movie is horror and action and comedy movie at the same time. Should I multiply or add these weighted features, I have no idea. Also I do not know why we use weighting in the first place at all. Can you help me get through this? By the way, let me say that each movie will be regarded as a document and then tf-idf calculation is done on them.
That's a good question. This task would be referred to as multi-label encoding. Bascially if a movie belongs to several genres, you one hot-encode each genre and add the vectors.
If there were only 6 genres (horror, romance, action, adventure, comedy, fantasy) For instance a movie that is horror, action and comedy (The Dead don't Die?):
- horror = [1, 0, 0, 0, 0, 0]
- action = [0, 0, 1, 0, 0, 0]
- comedy = [0, 0, 0, 0, 1, 0]
So a movie that belongs to all three would be encoded as: [1, 0, 1, 0, 1, 0]. A movie that only has a category then its encoding is a one-hot encoded label.
You can perform this task in scikit-learn with a multi label binarizer