Research Article
A Hybrid Neural Network BERT-Cap Based on Pre-Trained Language Model and Capsule Network for User Intent Classification
Algorithm 1
The dynamic routing algorithm.
| Input: all lower-level capsule U = [u1, u2, …, um] | | Output: the result of the squash activation function a | (1) | procedure Routing (ui, r) | (2) | for all lower-level capsules ui: bi = 0 | (3) | for r iterations do: | (4) | for all lower-level capsules ui: ci = softmax (bi) | (5) | The higher-level capsule: s = | (6) | The higher-level capsule: a = squash (s) | (7) | for all lower-level capsules ui: bi = aui | (8) | return a |
|