Hierarchical Multi-label Classification of Text with Capsule Networks
Paper · 2019 · Rami Aly, Steffen Remus and Chris Biemann
Summary
A book blurb can tell you that a novel is fiction without giving you enough evidence to decide whether it is fantasy or a mystery. Another blurb may justify several specific genres at once. A system that assigns these categories has to recognize both what the genres share and what distinguishes them. It also has to respect the catalog’s structure. A prediction of Fantasy should include Fiction, while a prediction of Fiction can stand by itself. The paper studies this form of text classification, known as hierarchical multi-label classification, and tests whether capsule networks can handle unusual combinations of labels.
The authors give every category its own capsule, a group of processing units whose output is a vector. The length of the vector indicates how strongly the system predicts the category. Its direction can vary with the evidence in the document. A procedure called dynamic routing repeatedly adjusts how much each piece of encoded text evidence contributes to each category. This gives a broad genre and its more specific descendants a way to draw on different evidence within the same blurb. A separate correction step handles predictions that leave out a required ancestor. The authors introduce the BlurbGenreCollection, an openly available collection of English book blurbs with a genre hierarchy, and also test on Web of Science research abstracts.
On the BlurbGenreCollection test split, the capsule network achieves the highest micro-averaged F1, at 74.37, and the highest recall, at 71.73. The linear support vector classifier is more precise, and the recurrent baseline has the highest exact match score for complete label sets. The ranking changes on the standard Web of Science test split, where each abstract has a fixed parent–child pair. The convolutional baseline scores 87.71 in micro-averaged F1, compared with 81.69 for the capsule network. The choice of benchmark therefore matters both for the overall ranking and for what the comparison reveals about predicting labels together.
The clearest evidence comes from tests that separate familiar label combinations from unusual or unavailable ones. On book blurbs whose complete genre combinations were absent from training, the capsule network achieves a micro-averaged F1 of 56.98, ahead of the convolutional and recurrent baselines in that comparison. When the authors alter the Web of Science training labels so that each abstract is shown with either its parent or its child label, the capsule network achieves 67.23 F1 on the unchanged test split. The controlled comparison supports the authors’ argument that capsules can help put separately learned category evidence together. The standard Web of Science results and the exact match scores on book blurbs show the conditions under which that advantage does and does not appear.
Deep dive: Hierarchical Multi-label Classification of Text with Capsule Networks
A study of how capsule networks assign related labels to text, using book blurbs and research abstracts to test when routing helps. · about 34 minutes to read
The problem and its context
A category can be broad, specific, or both
A flat classification task gives the system a list of categories. In a hierarchy, the relationship between categories carries information of its own. Fantasy sits below Fiction, so a book identified as Fantasy also belongs to Fiction. The reverse implication fails because Fiction can apply to a book outside Fantasy or to a book with no more specific genre assigned. A classifier has to deal with the direction of that relationship as well as the textual evidence for each category. The difficulty becomes apparent when the same words are useful evidence for both a broad category and a narrow one.
The book data also allow the most specific recorded category to have children of its own. A book can be catalogued as Children’s Books without being placed in Middle Grade books. This matters for a classifier that chooses how far to descend. Treating every case as a search for a terminal category would force some blurbs into more detail than their recorded labels support. Treating every case as a broad assignment would miss the details that are present for other books. The prediction must allow the document to stop at an internal category or continue farther wherever the evidence warrants it.
Multiple labels introduce a second question about the shape of the answer. A document can justify more than one genre assignment, and the ancestors required by those assignments also count as labels. Two documents can therefore share a broad genre while differing in the particular descendants they receive, or share several categories while differing by a single additional genre. Learning a list of common complete answers would handle familiar patterns. The paper asks what happens when the system sees a document whose answer brings known categories together in a way the training examples did not display.
That question is especially important when the documents themselves use similar language. A blurb for a book marked Fiction and a blurb for a book marked Fiction and Fantasy can have common words and short sequences of words. Such overlap can be useful for identifying Fiction while offering little help in deciding whether Fantasy also applies. A detailed genre taxonomy increases the number of distinctions of this kind. The authors argue that a system needs to retain information for each category separately so that it can preserve useful common signals and still recognize evidence specific to a child category.
The hierarchy also tells the system more about some errors than others. Emitting Fantasy alone is structurally inconsistent because Fiction is required. Emitting Fiction alone is structurally valid even when the reference assigns Fantasy as well. A consistency check can detect the first problem by examining the predicted labels and their relationships. Resolving the second requires a better decision about the content. This distinction explains why the authors separate the mechanism that recognizes labels from the post-processing rule that makes use of the hierarchy.
Local and global classification
The earlier approaches described in the paper include local and global ways of organizing a classifier. A local approach uses separate classifiers for portions of the hierarchy. A global approach covers the full set of categories with a single classifier. The paper favors the global arrangement. The authors argue that replicating complex neural architectures across local tasks can be expensive, that such systems take work to analyze, and that each architecture introduces choices about its settings. A shallow global architecture lets them investigate the organization of the predictions without building a cascade of substantial classifiers.
Earlier neural work had already used the hierarchy at different points in a system. The paper describes Cerri and colleagues connecting multilayer perceptrons, with a separate unit of classification for each level. It describes HDLTex as combining neural components for a hierarchy with two levels, using architectures such as convolutional networks, long short-term memory networks and multilayer perceptrons. These systems make the position of a category in the hierarchy part of how the architecture is arranged.
Another choice is to treat the full category inventory as a multi-label prediction problem and supply information about category relationships through the initial weights. The paper describes Baker and Korhonen adapting this strategy to a convolutional classifier. It credits Kurata and colleagues with the underlying approach of using label co-occurrence, meaning labels that appear together on training examples. Initial weights can then favor connections associated with combinations already present in the data. Aly and colleagues adapt that idea to capsules and also use co-occurrence initialization for the comparable neural baselines.
Convolutional and recurrent networks provide established starting points for the text side of the study. The convolutional approach learns filters that respond to useful patterns across windows of words. A recurrent approach builds a representation by processing the text as a sequence. The authors draw their convolutional baseline from Convolutional Neural Networks for Sentence Classification. For this study the question is what happens when text features have to serve several related decisions, especially when the decisions represented together in a training example differ from those required at test time.
Why capsules were a candidate
Capsules originated in work on images. The paper describes the earlier design as assigning a capsule to each handwritten digit category and using grouped feature outputs to encode properties of the input. A category capsule could signal the presence of a digit through the length of its output vector while retaining other information in the vector’s direction. The cited work also gave the authors a procedure for deciding dynamically which features should contribute to which capsule. They saw a possible parallel with text whose wording provides several overlapping kinds of evidence.
Prior applications to text gave more direct reasons to try that transfer. The paper describes early sentiment work that used capsules with a recurrent network and omitted dynamic routing. It also discusses a text classification study by Zhao and colleagues in which the training documents had single labels and the test documents could have multiple labels. In that setting, routing was interpreted as giving different categories their own way to select input evidence. The difference between training assignments and test assignments makes this earlier experiment particularly close to the question about label combinations in hierarchical classification.
The paper also discusses capsule routing for relation extraction and for learning several tasks together. In the relation work, capsule features followed a bidirectional recurrent encoder. In the multitask work, the routing procedure could bring together features useful to a particular task. The authors situate their study alongside other uses, including zero-shot user intent detection. Their study takes the category-specific feature grouping from this line of work and asks how it behaves when the output categories are related by a known hierarchy and a document can occupy several positions in it.
The method, step by step
From a blurb to an answer set
The starting point is to spell out what counts as a correct answer. For a text with an explicit category, the target contains that category and every category above it along the relevant path. If Fantasy is assigned, Fiction belongs in the target as well. All eligible categories, including internal ones, have their own output. The text goes through the same classifier for the full inventory. A single pass can supply evidence for categories from different parts of the hierarchy, and an ancestor does not need to be scored first in order for a descendant to receive a score.
The classifier first represents the document as a sequence of word embeddings, which are vectors associated with words. The authors use pretrained fastText vectors from work on word vectors with subword information. Training can adjust these vectors for the classification task. The convolutional part of the capsule classifier then transforms windows of this sequence into text features. This is the part of the design closest to a conventional convolutional text classifier. The major change comes in how the system sends those features onward to the category outputs.
The paper describes a compact architecture with four layers. The convolutional output supplies the primary capsules, which turn local feature information into vectors. The classification capsules receive proposals based on those vectors. There is a classification capsule for every category, whether the category is broad or specific. Each primary capsule can propose a different transformed vector to each output capsule. The proposals are weighted through routing, so the amount of support a feature provides to an output is worked out for the document being classified.
For a reader following a particular genre, the distinction is between recognizing a feature and deciding where to use it. A primary capsule can encode some combination of words, local order, and meaning. A genre capsule receives several proposals informed by such features. If the proposals align, the routing procedure can give those connections more weight. Fiction and Fantasy can end up with support from overlapping or different groups of primary capsules. Their final scores each reflect the evidence collected for that category. The genre hierarchy then provides a separate basis for completing or correcting the answer.
From document text to a hierarchy-aware label set
The steps in order.
What the vectors represent
A classification capsule returns a vector with a direction and a length. The paper uses length as a pseudo-probability, a score for how strongly the capsule is active. Direction provides room to encode different ways in which the same category can be expressed. Two blurbs might therefore produce vectors of similar length for a category while producing different directions. The paper gives this as an account of what the representation can express. The output coordinates do not come with a list of named genre attributes.
A primary capsule also returns a vector. The paper describes such vectors as being able to represent information about local word order and meaning. The feature vector it emits is the same starting point for its proposals to the various classification capsules. Each destination has its own transformation for that source, however. A feature can therefore produce one proposed vector for Fiction and another for a narrow genre. The learned transformations and the per-document routing coefficients serve different roles. Training adjusts the transformations. Routing recalculates the coefficients for the input at hand.
ûⱼ∣ᵢ = Wᵢⱼ uᵢ
Here i identifies a primary capsule and j identifies a classification capsule. The vector uᵢ is the output of primary capsule i. The matrix Wᵢⱼ transforms that vector for the connection from i to j. The resulting vector ûⱼ∣ᵢ is the proposal that primary capsule i makes to classification capsule j. The bar in the proposal’s subscript distinguishes the destination from the source. The multiplication changes the representation into the form expected at that destination.
The transformed vector is a proposal about the category capsule’s output, instead of a finished category score. It can be judged against the proposals from other primary capsules and against the combined result for the category. This comparison makes it possible for a feature to have a strong transformation available for a category yet receive a small routing coefficient in a particular document. Conversely, several modest pieces of evidence can make compatible proposals and contribute together. This is the behavior the authors want to investigate when parent and child labels have some evidence in common.
How dynamic routing changes the weights
For every source and destination pair, routing maintains a value used to calculate the next set of coefficients. The algorithm begins with those values equal across destinations. It then normalizes the outgoing values for each primary capsule with softmax. Softmax turns a group of scores into a distribution over choices, assigning a greater share to a higher score. Here the choices are the classification capsules to which that primary capsule can contribute. Each primary capsule has its own distribution over the destinations.
bⱼ∣ᵢ ← 0
The symbol bⱼ∣ᵢ denotes the routing logit from primary capsule i to classification capsule j. A logit is a score before the normalization step. The arrow indicates assignment, and 0 is the starting value for every source and destination pair. Because all the initial scores for a primary capsule are equal, the initial normalization treats its possible destinations alike. This initialization of the routing logits is separate from how the authors initialize the learned transformation matrices.
cᵢ ← softmax(bᵢ)
The vector bᵢ collects the current routing logits from primary capsule i to the classification capsules. The vector cᵢ collects the corresponding normalized coupling coefficients. The entry for destination j is cⱼ∣ᵢ. The function softmax normalizes across destinations for the same primary capsule, and the arrow assigns its output to cᵢ. When one of these coefficients gains a larger share, the same primary capsule has a smaller share of its routing weight available for other destinations.
sⱼ = Σᵢ cⱼ∣ᵢ ûⱼ∣ᵢ
The vector sⱼ is the combined input to classification capsule j. The summation sign Σᵢ indicates that all primary capsules i contribute a term. For each source, cⱼ∣ᵢ is the current coupling coefficient and ûⱼ∣ᵢ is its transformed proposal to j. The coefficient scales the vector before it is added. This step collects evidence by destination, whereas the softmax that determines the coefficients operates by source.
vⱼ = squash(sⱼ)
The vector vⱼ is the output of classification capsule j at the current iteration. The function squash applies a nonlinear scaling to the combined vector sⱼ, producing an output whose length is bounded between zero and one. This lets the system use length for category activation and retain the vector for the next agreement calculation. The paper specifies the role of the squash operation and gives it by name in the routing procedure.
bⱼ∣ᵢ ← bⱼ∣ᵢ + ûⱼ∣ᵢ · vⱼ
The left side is the updated routing logit for the connection from primary capsule i to classification capsule j. On the right, its previous value receives the dot product, written ·, of the proposal ûⱼ∣ᵢ and the current category output vⱼ. A proposal that agrees strongly with the output gives that connection a larger increment. At the next normalization, it can obtain a larger coefficient relative to other outgoing connections from the same primary capsule. The procedure repeats for r iterations, where r denotes the number of routing rounds in the algorithm.
The weighted sum and the agreement update form a feedback process within the processing of a single document. The first combined vector uses evenly initialized routing logits. The next one gives greater relative influence to proposals whose direction is compatible with the output they helped form. As the procedure repeats, the evidence reaching a classification capsule can concentrate on a group of mutually supportive proposals. A primary capsule can still distribute its support over several destinations. The normalization changes relative weights and does not require a separate hard choice of a single destination for each source.
The authors contrast this sort of aggregation with max pooling in their discussion of earlier capsule work. A pooling operation that retains only the strongest response to a filter can discard other responses that would have been informative when combined. Routing uses multiple proposals and gives each category its own aggregate. For closely related genres, the intended benefit is that a common feature can support a broad category while something more specific can support a narrower one. Whether learning produces that pattern, and whether it improves predictions, are empirical questions addressed by the comparisons and connection visualizations.
How the system learns and makes a final prediction
score for category j = ‖vⱼ‖
Here j identifies the category and its classification capsule. The double bars ‖ ‖ mean vector length, and vⱼ is the capsule output after routing. The score is the value used for predicting the presence of that category. Training uses the margin loss adopted from the earlier dynamic routing work. In this setting, the loss encourages a strong activation for an assigned category and a weak activation for a category absent from the target. The paper names this loss without setting out its full formula or margin values.
The authors also give the learned connections a starting configuration informed by co-occurrence. When labels appear together in the data, the weights between a primary capsule and the associated co-occurring classification capsules are initialized from a uniform distribution. The other weights in this initialization are set to zero. A pair such as Fiction with Fantasy can therefore influence the starting pattern because the labels occur together in the genre data. The initialization biases learning. It does not determine the relative routing coefficients for a new document, which are calculated from the proposals and their agreement.
This creates distinct opportunities for the training data and the hierarchy to influence the system. Training labels indicate which outputs should activate and which co-occurrences can inform initial weights. Dynamic routing decides how to combine feature proposals for an individual text. The hierarchy supplies the rule for judging whether a predicted set is missing required ancestors. In particular, the category capsules can still produce a strong Fantasy score and a weak Fiction score. A capsule’s eligibility to collect evidence does not depend on an earlier decision at the parent category.
The authors consider three ways to correct such a set. Extension adds missing ancestors. With Fantasy alone as the example, extension adds Fiction. Removal deletes a prediction lacking the required ancestor and deletes its dependent descendants. Threshold correction uses the classifier’s confidence in the ancestors. For an inconsistent prediction, it averages the ancestor confidence scores and adds the ancestors when the average clears the threshold. The reported comparisons use the threshold method with a confidence value of 0.2. The authors chose it and co-occurrence initialization after preliminary experiments in which the options performed consistently well.
Preparing input and fitting the classifiers
The input pipeline limits texts to the first 100 tokens for the fixed-length convolutional and capsule architectures. According to the paper, this accounts for the entire input in more than 90% of the dataset. The authors remove stop words, most punctuation, and words whose frequency is below 2. In the book blurbs, they retain some punctuation, including exclamation marks, because it could provide a clue about writing intended for younger audiences. That decision reflects the nature of the input. A mark chosen to address a reader can carry information about the book’s category even though it is not a genre word.
The neural classifiers are configured with Adam as their optimizer and zero dropout probability.5 and minibatches of 32 examples. An optimizer updates the learned weights based on the training loss. Dropout reduces reliance on particular activations during training, and a minibatch is the group of examples used for an update. The capsule classifier is trained for 4 epochs, or passes through the training data. It uses primary capsule vectors of dimension 8 and classification capsule vectors of dimension 16. The reported capsule counts for the BGC and WOS settings are 55 and 32, respectively, and the associated window settings are 90 and 50.
The reported starting learning rates for the capsule classifier are 0.001 on BGC and 0.002 on WOS. The corresponding decay settings are 0.4 and 0.95. The baseline neural classifiers have their own settings and use binary cross-entropy, which supplies a training loss for the individual label decisions. The paper makes replication code available under BlurbGenreCollection-HMC and also makes the blurb collection available. The classification procedure can be understood from the distinction between the learned matrices, the routing computation within each input, and the correction applied to the resulting labels.
Experiments and results
Book blurbs and research abstracts
The BlurbGenreCollection, abbreviated BGC, contains 91,892 book blurbs. The blurbs are promotional descriptions, and the collection includes book metadata such as authorship, publication date and page count. The authors gathered the material from the Penguin Random House website with permission. They removed categories that describe a format instead of content, such as audiobooks, and discarded category combinations that occurred fewer than five times. Those choices leave a corpus organized around content-related genres and still containing considerable variation in which genres are assigned together.
A BGC book has at least one genre, and its assigned labels include the ancestors of the most specific genres it receives. The paper connects these properties to the conventions discussed in RCV1. Every BGC child category has a single parent. Taken together, the categories form a forest, meaning a collection of trees. The 146 classes are spread across 4 levels, with 7 at the broadest level and then 46, 77 and 16 at successive levels. A label can be the most specific assigned genre for a blurb even when the tree continues below it.
A BGC text contains an average of 93.56 tokens according to the dataset statistics. A book has an average of 3.01 assigned labels, and the collection has 1342 distinct label combinations. The standard deviation of the number of samples per category is 4374.19. That statistic describes variation in the amount of material attached to different categories. The distinct-combination count describes a separate aspect of the problem, because even a category with many examples can appear in configurations that are rare. The authors use both properties to characterize BGC as an uneven and structurally varied classification task.
The comparison dataset is WOS-11967, drawn from Web of Science. It contains 11,967 abstracts of published research papers, with an average length of 125.90 tokens. It has 40 categories, distributed as 7 broad categories and 33 children. Every abstract has exactly one parent category and one child category. The child identifies the complete pair, so the number of distinct label combinations is 33. Once the child is correctly identified, the hierarchy determines the other label in the reference set. This gives the classifier a much narrower range of permissible answers than it has on the blurb collection.
The dataset comparison also reports the normalized entropy of the observed combinations. Entropy describes how spread out the frequency distribution is across the possibilities, and its normalization makes the value easier to compare across collections of different sizes.
Hₙ = H / log K
The symbol Hₙ means normalized entropy, H is the entropy of the label-combination frequencies, and K is the number of distinct combinations. The slash indicates division, and log is the logarithm. The paper reports 0.7345 for BGC and 0.9973 for WOS-11967. Among the combinations that occur, the WOS frequencies are much closer to an even distribution. Its standard deviation of samples per category is 529.43. The entropy and category count variation describe different distributions. A broad category can collect many examples even if the child combinations underneath it are well balanced overall.
The paper reports a split of 64% train, 16% validation and 20% test. The training portion supplies examples for learning the weights, the validation portion provides separate data for development, and the test portion supplies the reported evaluation. Keeping the test portion separate also gives the authors a way to ask whether a test example has a complete label set that occurred in training. In the modified WOS comparisons, they hold the test data fixed while changing the training assignments. The evaluation then asks how well the classifiers recover the same complete categories under different supervision.
What the capsule network is compared with
The non-neural baseline uses a separate linear support vector classifier for each label, an application of Support-Vector Networks. For a given label, its task is to distinguish documents carrying that label from all the other documents. It represents each document as a bag of words weighted by TF-IDF, which emphasizes terms according to their frequency in a document and their distribution across documents. This gives the baseline a direct way to learn which words are associated with individual categories without keeping the order in which those words appear.
The convolutional neural network, or CNN, learns responses to windows of words. Its reported filter counts are 1500 on BGC and 1000 on WOS, and it uses window widths 3, 4 and 5. The corresponding learning rates are 0.0005 and 0.001, with decay settings of 0.9 and 1. The authors train it for 30 epochs on BGC and 20 on WOS. This baseline matters because the capsule architecture also starts with convolution. The comparison puts a familiar way to classify from convolutional features next to one that groups and routes transformed feature vectors to category capsules.
The recurrent baseline uses long short-term memory, abbreviated LSTM. Its representation accumulates information while processing the word sequence. The authors use recurrent dropout and report 1500 hidden units on BGC and 1000 on WOS. The learning rates are 0.005 and 0.001, with 15 epochs on BGC and 25 on WOS. As with the CNN, the outputs are trained with binary cross-entropy. Together the recurrent and convolutional baselines provide comparisons with two ways to learn text features, and the linear classifier gives a comparison with a word-frequency representation.
What the scores count
Precision asks what share of the predicted labels are in the reference assignments. Recall asks what share of the reference assignments the classifier makes. Micro-averaging pools the individual label decisions across the test examples before measuring those quantities. The micro-averaged F1 combines precision and recall through their harmonic mean. A classifier gains recall by returning more correct labels and can lose precision if it also adds too many incorrect ones. F1 reflects both consequences. Common labels have considerable influence because every occurrence contributes to the pooled decisions.
Subset accuracy evaluates an entire prediction for a text at once. It counts a success when the predicted set exactly matches the reference set. A document can contribute several correct decisions to micro-averaged measures and still count as a miss in subset accuracy because a category was omitted or added. The gap between these measures becomes especially informative when a document has many assigned categories. For BGC, exact match can require choosing the right stopping points in several parts of the hierarchy as well as including the ancestors of all the specific labels.
The main comparison reports neural results across three runs and gives 95% confidence intervals. The results table lists single values for the linear support vector baseline. These intervals describe the reported variation for the neural comparisons. The rankings below refer to the reported central scores. The paper also reports analyses within the test data, separating examples by hierarchy level and number of labels, and tests settings in which the category combinations available during training are restricted.
BlurbGenreCollection results
Comparing classifiers on BGC test micro-averaged F1
The capsule network leads on F1 for the book blurbs.
The numbers
| System or setting | F1 |
|---|---|
| Linear SVM | 71.23 |
| CNN | 73.08 |
| LSTM | 72.16 |
| Capsule network (this paper) | 74.37 |
On the full BGC test split, micro-averaged F1 is 74.37 ± 0.35 for the capsule network, 73.08 ± 0.27 for the CNN, and 72.16 ± 1.01 for the LSTM. The SVM scores 71.23. The capsule classifier’s strong contribution is recall. It achieves 71.73 ± 0.63, compared with 69.12 ± 1.24 for the LSTM, 64.75 ± 0.41 for the CNN, and 61.11 for the SVM. Among the four classifiers, it recovers the largest share of the reference label assignments.
The precision ranking is different. The SVM reaches 85.37 on the BGC test split, and the CNN follows at 83.87 ± 0.09. The capsule network has precision of 77.21 ± 0.54, with the LSTM at 75.49 ± 3.54. The SVM’s precision together with its recall describes a classifier whose positive predictions tend to be correct and whose coverage of the assigned genres is relatively low. The capsule network’s F1 lead reflects the combination of higher coverage and the precision it retains.
The top central score for exact set recovery goes to the LSTM, with subset accuracy of 37.99 ± 1.52. The capsule network records 37.70 ± 0.68, the CNN 37.26 ± 0.52, and the SVM 35.79. These are results on the same BGC test split as the micro-averaged results. In practical terms, a reader looking for more correct genre assignments across the whole catalog would see the capsule network leading on recall and F1. A reader evaluating each blurb solely by whether its complete assigned set was recovered would see the LSTM with the highest reported central score.
Web of Science results
Comparing classifiers on WOS-11967 test micro-averaged F1
The CNN leads on the standard research abstract task.
The numbers
| System or setting | F1 |
|---|---|
| Linear SVM | 80.20 |
| CNN (this paper) | 87.71 |
| LSTM | 85.63 |
| Capsule network | 81.69 |
On the unmodified WOS-11967 test split, the CNN has the highest micro-averaged F1 at 87.71 ± 0.58. The LSTM reaches 85.63 ± 1.22, the capsule network reaches 81.69 ± 0.70, and the SVM scores 80.20. The CNN also leads on micro-averaged precision and recall, with 91.68 ± 1.00 and 84.06 ± 0.93, respectively. The LSTM reports 87.56 ± 1.04 precision and 83.78 ± 1.69 recall. This comparison gives the CNN the strongest balance across individual category decisions on the standard abstracts task.
The capsule classifier’s WOS precision is 82.75 ± 2.42, and its recall is 80.67 ± 1.27. The SVM shows a different balance, with precision of 89.84 and recall of 72.43. The LSTM has the highest subset accuracy at 76.80 ± 2.15. The CNN records 75.16 ± 1.66, the capsule network 64.97 ± 0.49, and the SVM 56.47. The capsule system therefore improves on the linear baseline in recall, F1 and exact recovery on WOS, while the convolutional and recurrent classifiers rank ahead of it on those same measures.
The change in ranking across the collections is central to interpreting the experiment. On BGC, an answer can stop at an internal genre and can combine categories from different parts of the forest. On standard WOS, every answer has the same size and follows a short path through the hierarchy. The experiments show that the capsule architecture is competitive on the first task and trails the stronger neural baselines on the second. To examine whether the difference comes from the way labels have to be combined, the authors look inside the book results and then change what the WOS classifiers see during training.
What the ablations show
Performance by depth and by number of labels
The paper’s diagnostic experiments vary which examples are scored or which labels are available for training. The first analysis breaks the test scores down by the levels of the hierarchy. The paper’s figure also shows cumulative scores, which collect results across levels. This view helps distinguish finding a broad category from making the more specific decisions farther down a path. A single aggregate score can give substantial influence to the broad categories that appear in many answers. Looking at each level gives the narrow categories a clearer place in the comparison.
The authors observe a decline in performance at deeper levels. On BGC, the capsule classifier leads the comparison at every level shown, and its margin grows for the more specific levels. This supports one part of the motivation for capsules. A classifier that recognizes Fiction routinely can still have trouble deciding which kind of fiction a blurb describes. A lead at the more specific levels shows that the capsule result extends to those decisions. The level analysis also reflects whatever differences in data availability and category difficulty accompany depth, so it leaves those factors joined.
A second analysis groups BGC test examples by label cardinality, which is the number of assigned labels in a document’s reference set. This includes ancestors. A large cardinality can reflect a long path, more than one path, or both. The capsule network fares worse than the stronger comparisons on groups with cardinalities 1 and 2 and begins to do better at 3. At cardinalities 9 and 11, the authors describe the capsule classifier’s F1 as nearly twice that of the baselines. The groups become much smaller as their cardinality grows, making the extreme cases relatively uncommon in the overall evaluation.
The cardinality result ties the aggregate performance difference to particular types of examples. When a blurb has few labels, success depends on comparatively few category decisions, and a common pattern may already describe the complete answer. With more labels, the classifier has to find evidence for a richer set and reconcile it with the hierarchy. A lead on those examples is consistent with making better use of several sources of evidence. It also helps explain why a large lead in some groups can accompany a more modest difference on full-test F1. The smaller groups contribute fewer decisions to the pooled score.
Standard WOS occupies a single cardinality for every example. Its parent and child annotations always appear together during normal training, and the reference always has two labels. The authors use this property to explain why the capsule network’s advantage at large BGC cardinalities has no direct counterpart on the unmodified abstracts task. The modified training experiment then asks the related question in a different way. With the same WOS test targets, can a classifier recover categories together when its training targets provide them together less often, or never?
Book blurbs with unseen complete label combinations
The first focused comparison takes 5, 943 examples from the BGC test split whose complete combinations do not appear in the training split. The classifier still has the same category inventory. The novelty concerns which assigned labels occur together for a particular blurb. A category in an unseen combination can have been learned from other documents with other assignments. The test therefore addresses whether the system can assemble an answer when it has no training example with exactly that set. It does not require the output to contain a newly introduced genre.
The capsule network has the highest F1 in this subset comparison, at 56.98. The CNN gets 55.34, and the LSTM gets 52.13. The capsule network’s recall is 53.30, compared with 46.21 for the CNN and 45.79 for the LSTM. Precision is highest for the CNN, at 68.95, followed by 61.21 for the capsule network and 60.48 for the LSTM. The linear SVM does not appear in this subset comparison. Among the tested classifiers, the capsule system again recovers more of the required assignments, while the convolutional classifier produces the most precise positive predictions.
The micro-averaged scores tell us how well the individual label decisions hold up when the full combinations are unfamiliar. They do not give an exact match rate for this slice. A system can improve recall by finding additional correct members of many unfamiliar sets, even if it rarely gets every set right. That is a meaningful form of generalization for a classifier built out of category-specific outputs. Its measured scope here is better pooled recovery of labels within unseen combinations. The full-set level of performance for those same examples remains unreported.
The subset also provides a natural comparison, drawn from the test split of a real catalog, with whatever other properties accompany unseen combinations. Some of these examples can have more labels, rarer categories, more specific categories, or features that make their labels harder to identify. The analysis selects for novelty of the set and does not equalize those other properties. That motivates the WOS intervention. By altering training annotations while leaving the test cases alone, the authors can observe a change in relative performance without also switching to a new collection of texts.
Suppressing label pairs during WOS training
In the milder WOS intervention, the authors remove 50% of the child labels in training. This makes some of the training annotations end at the parent, although every test target still has both members of its pair. On the unchanged WOS test split, the CNN achieves an F1 of 75.15, the LSTM 73.00 and the capsule network 71.59. The exact match scores are 36.28 for the CNN, 35.09 for the LSTM and 35.21 for the capsule network. Under this intervention the capsule system still trails the CNN on both measures, while its subset accuracy is close to that of the recurrent classifier.
The stronger intervention keeps either the parent label or the child label for every training abstract. No training target presents a complete pair in that condition. Test targets continue to require both categories. The change challenges the classifier to learn evidence for a parent from some training cases and evidence for a child from others, then produce the combined assignment at evaluation. The reported result is a clear change in the ranking of the compared neural classifiers.
WOS test F1 after training with either parent or child labels
The capsule network leads when no training target contains a complete pair.
The numbers
| System or setting | F1 |
|---|---|
| CNN | 41.93 |
| LSTM | 38.74 |
| Capsule network (this paper) | 67.23 |
Under this parent-or-child training condition, the capsule system scores 67.23 in test F1 and 34.27 in subset accuracy. The CNN scores 41.93 in F1 and 16.36 in subset accuracy, and the LSTM records 38.74 and 5.28, respectively. The F1 result shows that more reference labels are recovered at a better overall balance of precision and recall. The subset accuracy result establishes that the capsule classifier also recovers more complete pairs. Its advantage in this comparison therefore extends beyond partial credit for recognizing one member of a pair.
Both interventions reduce the performance of the neural classifiers relative to their standard WOS results. The ranking under incomplete supervision matters because the label pair itself is familiar as part of the task and the evaluation examples remain the same. When some complete pairs still appear in training, the CNN and LSTM mostly retain their advantage on F1. When training never presents the pairs as complete answers, the capsule classifier shows better recovery. This supports the authors’ account that its separate category representations can be assembled with less dependence on observing all the members of an answer together during training.
Where the routing sends the evidence
The authors use a connection visualization to investigate how that assembly might work. It shows routing strengths between selected primary capsules and classification capsules for two BGC blurbs. One blurb is labeled Fiction and Mystery & Suspense. The other is labeled Fiction and Fantasy. The authors reduce the number of categories and primary capsules displayed so the connections can be examined. Both examples share Fiction, which lets the comparison illustrate what stays broad and what changes with the specific genre.
The visualization shows primary capsules with strong connections to Fiction that differ from those strongly connected to its children. It also gives an example of a primary capsule that the authors associate with evidence for Mystery & Suspense. Primary Capsule 5 has no clear category preference in the Fantasy example, which the authors interpret as a result of the relevant mystery features being absent. Other primary capsules give fairly similar support to the parent and the relevant child. The authors relate those shared connections to similarities between the categories.
These pictures illustrate degrees of specialization within the same routing procedure. Evidence that points to Fiction can be collected even when the document supplies little support for one particular child. Evidence for a specific genre can be weighted more heavily for that genre, and some feature vectors can help both. That behavior makes the co-occurrence results easier to interpret. Separate output capsules give the classifier a place to preserve category evidence, and routing can vary which proposals each output uses when the composition of the document changes.
The visualization and the controlled training comparisons answer different questions. The visualization shows how selected connections behave in concrete examples. The WOS experiments measure how predictions change when the training annotations cease to present complete pairs. The BGC comparisons show where in a varied catalog the capsule classifier tends to help. The paper uses those strands of evidence to argue for the role of routing and category-specific vectors. A comparison that removed routing while preserving the rest of the capsule architecture would be needed to measure that mechanism’s independent contribution.
Limitations
Scope and directions identified by the authors
The authors describe the study as an initial application of capsule networks to hierarchical multi-label classification. They deliberately choose a minimal capsule architecture so it can be compared with a simple CNN. That choice defines the result’s scope. The experiment evaluates a shallow global system with a classification capsule for each label. The authors suggest a future design in which capsule layers are cascaded and each layer corresponds to a particular hierarchy level. The paper leaves open how such a design would change the flow of evidence between parents and children or perform on the two collections.
The authors explicitly identify a condition under which they expect little advantage from capsules. The standard WOS task supplies a small, often observed set of parent–child assignments, each with the same cardinality. In that setting the two stronger neural baselines achieve higher scores. The authors explain their positive result chiefly through the need to combine rare or unseen sets, which makes the performance on ordinary WOS part of the paper’s scope. The study leaves room for a standard convolutional or recurrent classifier to be the stronger choice for a shallow hierarchy with a regular answer structure.
The authors also acknowledge that reasoning about individual categories can yield a prediction inconsistent with the hierarchy. Their architecture uses a shared routing computation, but each output still supplies its own category activation. The consistency treatment is therefore a post-processing rule. Extension, removal and threshold correction make different choices when confidence in a parent and child conflicts. The experiments report performance with the selected threshold strategy. They give no separate measurement of how often the raw outputs violate the hierarchy or how much each correction approach contributes to the scores.
Limits of the experimental comparisons
The two benchmarks differ along several axes. BGC consists of promotional book descriptions, while WOS consists of research abstracts. The text lengths, category inventories, depths, frequency distributions and permissible answer sets also differ. Consequently, the change in the ranking between those two benchmarks cannot isolate any one of those properties. The training interventions on WOS strengthen the case concerning co-occurrence by keeping the evaluation material fixed. Their scope is a particular way of making labels incomplete in a shallow hierarchy, with the same taxonomy still known at test time.
Suppressing a child or a parent changes the available supervision for the individual label and the available examples of its co-occurrence. The strongest WOS intervention alters both together. A classifier receives less direct evidence about when a given category should activate, and it stops seeing parent and child as simultaneous assignments. The reported ranking establishes which classifier handles this intervention better. It does not quantify how much of that advantage comes from maintaining separate category evidence, coping with missing targets, or combining features through routing.
The architectures also differ beyond the presence of routing. The capsule network has vector-valued outputs and uses a margin loss. The comparison networks use a different arrangement of text features and binary cross-entropy. The reported hyper-parameters and training durations vary. This is a practical system comparison that can reveal different behavior on unusual label assignments. Assigning a precise share of the improvement to dynamic routing would require a component comparison within otherwise matched classifiers. The connection visualization supplies examples of routing behavior, and its two selected documents leave open how commonly those patterns occur.
The hierarchy itself remains restricted in the reported experiments. In BGC a child has a unique parent, and in WOS a document is associated with a direct parent–child pair. These tests leave open what would happen if a category inherited from multiple parents or if decisions had to pass through a substantially deeper structure. BGC also omits the category combinations that appeared fewer than five times in the gathered data. Its unseen-combination results are evidence about a split of the retained catalog and its known categories. The experiment does not measure what happens with the discarded combinations or with labels added to the hierarchy after training.
What the metrics and examples leave open
Micro-averaged F1 credits each correct assignment, including an ancestor that may be common in the test data. It gives more influence to often occurring categories through their many assignments. Subset accuracy imposes the most demanding condition at the document level, exact set recovery, but treats a near miss as a miss just the same. The depth and cardinality analyses help locate the gains between these views. They do not establish equal improvement across rare categories, and the small groups at larger cardinalities make those comparisons harder to generalize without further information about their variability.
The word pseudo-probability is important to the interpretation of the outputs. A vector length is bounded and expresses strength of activation, which allows it to guide prediction and correction. The experiments evaluate the resulting classifications. They do not test whether a particular length corresponds to the empirical frequency with which the category is correct. Likewise, the visualized connections show which encoded vectors are strongly coupled to particular category outputs. The plots do not identify the words that determine those couplings or validate a fixed meaning for each dimension of a capsule vector.
Finally, the paper presents simplicity and the cost of complex local architectures as motivations. Its experimental results report classification quality and provide training settings. They leave comparative running time, resource use and the cost of routing over larger label inventories unmeasured. The findings establish a predictive advantage under some combinations of dataset and supervision, alongside stronger baseline performance under others. They give less information about the computational cost of obtaining that advantage or how it scales with a much larger taxonomy.
What came after
LGSA: Label Geometry Structuring and Aligning for Hierarchical Text Classification cites the capsule study and approaches hierarchical text classification through the organization and alignment of label geometry. The connection is at the level of the research problem. The capsule paper asks how separate category vectors can gather evidence for related labels within a document. The later work’s title places the structure of the label representations themselves at the center of the task. The citation establishes the capsule study as part of that later work’s context. It leaves open whether LGSA uses dynamic routing, evaluates on the BlurbGenreCollection, or compares its results directly with the capsule network.
Cite
Cite as Rami Aly, Steffen Remus and Chris Biemann. 2019. Hierarchical Multi-label Classification of Text with Capsule Networks. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop.
@inproceedings{aly2019hierarchical,
title = {{Hierarchical Multi-label Classification of Text with Capsule Networks}},
author = {Rami Aly, Steffen Remus and Chris Biemann},
booktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop},
year = {2019},
doi = {10.18653/v1/p19-2045},
url = {https://doi.org/10.18653/v1/p19-2045}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/aly-2019-hierarchical-multi-label-classification-text/