The idea to use a taxonomy to describe objects is very useful to train models that are more efficient to discriminate between similar classes. For instance, if a model confuses a spaniel and a mastiff, both dogs, the loss should be much lower than the confusion of a dog and a car. Therefore, we can use a taxonomy to penalize some errors more than others to better describe the data and to train a more powerful model.
For movies, a proper taxonomy is much more difficult because attributes are often subjective and not disjoint. For instance, there is no room for discussion if an animal has four legs or not, but if a movie should have the genre ‘mystery’ is not always clear. Therefore, we either have to build an ontology from scratch, with our own attributes, or we have to rely on the publicly available data. We decided to start with the public data first.
To toy with the data, we created some very simple taxonomies and combined them into one big feature vector. We started with the differentiation of countries. The concept is encoded as a tree like that:
West: USA, Europe
East: Near, Far
The idea can be generalized to many other attributes, like votes for a movie, the rating, or if a movie is for kids/teens or adults and so forth.
To see the benefits of such a coding, we use our country taxonomy. With a 1-hot encoding, a pair of movies from Japan and the US has the same “distance” as a pair of movies from Japan and Taiwan. However, since it is very likely that movies from the East share more general attributes, this fact should be also encoded in the features.
With the tree encoding we described above, it is obvious that movies from the East always share a “concept” feature (node), exactly like the movies from the West. If we interpret this as a tree, the distance of two nodes can be described by the number of edges “between” them.
Equipped with such a hierarchical encoding, we can turn the taxonomies into a metric to calculate the distance between two movies which can be used, for example, in a Siamese network to build a concept space.