Hostname: page-component-74656f9884-skzmx Total loading time: 0 Render date: 2026-11-06T01:35:00.213Z Has data issue: false hasContentIssue false

On clustering levels of a hierarchical categorical risk factor

Published online by Cambridge University Press:  01 February 2024

Bavo D.C. Campo*
Affiliation:
Faculty of Economics and Business, KU Leuven, Belgium
Katrien Antonio
Affiliation:
Faculty of Economics and Business, KU Leuven, Belgium Faculty of Economics and Business, University of Amsterdam, Amsterdam, The Netherlands LRisk, Leuven Research Center on Insurance and Financial Risk Analysis, KU Leuven, Belgium LStat, Leuven Statistics Research Center, KU Leuven, Belgium
*
Corresponding author: Bavo D.C. Campo; Email: bavo.campo@kuleuven.be
Rights & Permissions [Opens in a new window]

Abstract

Handling nominal covariates with a large number of categories is challenging for both statistical and machine learning techniques. This problem is further exacerbated when the nominal variable has a hierarchical structure. We commonly rely on methods such as the random effects approach to incorporate these covariates in a predictive model. Nonetheless, in certain situations, even the random effects approach may encounter estimation problems. We propose the data-driven Partitioning Hierarchical Risk-factors Adaptive Top-down algorithm to reduce the hierarchically structured risk factor to its essence, by grouping similar categories at each level of the hierarchy. We work top-down and engineer several features to characterize the profile of the categories at a specific level in the hierarchy. In our workers’ compensation case study, we characterize the risk profile of an industry via its observed damage rates and claim frequencies. In addition, we use embeddings to encode the textual description of the economic activity of the insured company. These features are then used as input in a clustering algorithm to group similar categories. Our method substantially reduces the number of categories and results in a grouping that is generalizable to out-of-sample data. Moreover, we obtain a better differentiation between high-risk and low-risk companies.

Information

Type
Original Research Paper
Copyright
© The Author(s), 2024. Published by Cambridge University Press on behalf of Institute and Faculty of Actuaries
Figure 0

Figure 1 Illustration of the NACE system for a company that manufactures beer. This economic activity is encoded as 1596 in NACE Rev. 1. Based on the NACE code, we assign the company to a certain category at a specific level in the hierarchy. For the purpose of this illustration, we shortened the textual description of the categories.

Figure 1

Table 1. Illustration of the textual information for NACE codes 1591, 1596, and 1598

Figure 2

Table 2. Number of unique categories per level in the hierarchy of the NACE-Bel (2003)

Figure 3

Table 3. Illustration of a possible encoding for the categories at the subsection level of the NACE Rev. 1

Figure 4

Table 4. Feature matrix $\mathcal{F}_1$, consisting of the engineered features for the categories at $l = 1$ in the hierarchy. The columns $_1\widehat{\boldsymbol{U}}^d$ and $_1\widehat{\boldsymbol{U}}^f$ contain the predicted random effects of the damage rate and claim frequency GLMM, respectively. The embedding vector is represented by the values in columns $\boldsymbol{e}_{\star 1}, \boldsymbol{e}_{\star 2}, \dots, \boldsymbol{e}_{\star E}$.

Figure 5

Table 5. Feature matrix $\mathcal{F}_2$, consisting of the engineered features for the categories at $l = 2$ in the hierarchy. The columns $_2\widehat{\boldsymbol{U}}^d$ and $_2\widehat{\boldsymbol{U}}^f$ contain the predicted random effects of the damage rate and claim frequency GLMM, respectively. The embedding vector is represented by the values in columns $\boldsymbol{e}_{\star \star 1}, \boldsymbol{e}_{\star \star 2}, \dots, \boldsymbol{e}_{\star \star E}$.

Figure 6

Algorithm 1. PHiRAT Pseudo-code

Figure 7

Figure 2 A fictive example illustrating how the PHiRAT algorithm clusters categories at the subsection and tariff group level. The textual labels of the categories are shortened for the purpose of this illustration.

Figure 8

Table 6. Overview of existing (dis)similarity metrics to quantify the proximity between observations. We select the angular similarity and angular distance, as they are better suited to measure the similarity between embeddings and also compatible with clustering algorithms

Figure 9

Table 7. Overview of clustering algorithms, together with their strengths and drawbacks

Figure 10

Table 8. Internal clustering validation criteria used in this paper

Figure 11

Figure 3 Empirical distribution of the individual companies’ (a) damage rates $Y_{it}$; (b) log-transformed damage rates $Y_{it}$ for $Y_{it} \gt 0$; (c) number of claims $N_{it}$; (d) log-transformed $N_{it}$ for $N_{it} \gt 0$. This figure depicts the $Y_{it}$’s and $N_{it}$’s of all available years in our data set.

Figure 12

Figure 4 Category-specific weighted average damage rates: (a) at all levels in the hierarchy; (b) of the section$\lambda$ and $\phi$, including those of their child categories at all levels in the hierarchy; (c) at the subsection and tariff group level. (b) is a close-up of the top right part of (a). In this close-up, the width of $\phi$ at the section level and its child categories is increased by a factor of 10 to allow for better visual inspection.

Figure 13

Figure 5 Category-specific expected claim frequencies: (a) at all levels in the hierarchy; (b) at the subsection and tariff group level.

Figure 14

Figure 6 Low-dimensional visualization of all embedding vectors at the subsection level, resulting from the pre-trained Word2Vec model, encoding the textual labels of the categories (see Fig. 4). The text boxes display the textual labels. The blue dots connected to the boxes depict the position in the low-dimensional representation of the embeddings.

Figure 15

Figure 7 Visualization of the search grid. The $x$-axis depicts the tuning grid $\mathcal{K}_1$ and the $y$-axis the encoder-specific feature matrix that is used. Here, we use k-medoids for clustering and the Caliński-Harabasz (CH) index as internal validation measure. The CH index is highest ($= 11.913$) for $\mathcal{K}_1 = 19$ in combination with $\mathcal{F}_1^{\text{USEv5}}$, indicating that this combination results in the most optimal clustering solution.

Figure 16

Table 9. Predictive performance on the training and test set

Figure 17

Figure 8 Cluster-specific weighted average damage rates at the subsection and tariff group level when employing PHiRAT with spectral clustering and the silhouette index.

Figure 18

Figure 9 Visualization of the grouped categories at the subsection level (see Fig. 2): (a) the clustered categories and the original random effect predictions $\widehat{U}_j^d$ and $\widehat{U}_j^f$; (b) the description of the economic activity of the categories.

Figure 19

Figure 10 Visualization of the clustered child categories at the tariff group level, with parent category manufacture of chemicals, chemical products, and man-made fibers at the subsection level (see Fig. 2): (a) the clustered categories and the original random effect predictions $\widehat{U}_{j^{\prime}k}^d$ and $\widehat{U}_{j^{\prime}k}^f$; (b) the description of the economic activity of the categories.