Talk to our team
Menu

Harnessing Mixed Features for Imbalance Data Oversampling: Application to Bank Customers Scoring

Authors
  • Abdoulaye Sakho
  • Emmanuel Malherbe
  • Carl-Erik Gauthier
  • Erwan Scornet
Affiliations
  • Artefact Research Center
  • LPSM, Sorbonne Université and Université Paris Cité
  • Société Générale
Accepted at
ECML PKDD 2025
Date
arXiv
2503.22730

Abstract

This study investigates rare event detection on tabular data within binary classification. Standard techniques to handle class imbalance include SMOTE, which generates synthetic samples from the minority class. However, SMOTE is intrinsically designed for continuous input variables. In fact, despite SMOTE-NC-its default extension to handle mixed features (continuous and categorical variables)-very few works propose procedures to synthesize mixed features. On the other hand, many real-world classification tasks, such as in banking sector, deal with mixed features, which have a significant impact on predictive performances. To this purpose, we introduce MGS-GRF, an oversampling strategy designed for mixed features. This method uses a kernel density estimator with locally estimated full-rank covariances to generate continuous features, while categorical ones are drawn from the original samples through a generalized random forest. Empirically, contrary to SMOTE-NC, we show that MGS-GRF exhibits two important properties: (i) the coherence i.e. the ability to only generate combinations of categorical features that are already present in the original dataset and (ii) association, i.e. the ability to preserve the dependence between continuous and categorical features. We also evaluate the predictive performances of LightGBM classifiers trained on data sets, augmented with synthetic samples from various strategies. Our comparison is performed on simulated and public real-world data sets, as well as on a private data set from a leading financial institution. We observe that synthetic procedures that have the properties of coherence and association display better predictive performances in terms of various predictive metrics (PR and ROC AUC...), with MGS-GRF being the best one. Furthermore, our method exhibits promising results for the private banking application, with development pipeline being compliant with regulatory constraints.

Cite this paper

@inproceedings{sakho2025harnessing,
  title = {Harnessing Mixed Features for Imbalance Data Oversampling: Application to Bank Customers Scoring},
  author = {Abdoulaye Sakho and Emmanuel Malherbe and Carl-Erik Gauthier and Erwan Scornet},
  booktitle = {European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases (ECML PKDD 2025)},
  year = {2025},
  doi = {10.1007/978-3-032-06118-8_15},
  url = {https://doi.org/10.1007/978-3-032-06118-8_15}
}

Introduction

Addressing class imbalance in binary classification presents a significant challenge across various machine learning applications [29, 26], such as medical diagnosis, customer churn prediction or anomaly detection [14, 22, 29]. In particular, detecting fraud is a prime issue in banking [11, 18]: the vast majority of customers make legitimate transactions, while the fraudulent ones represent only a minority but have a significant operational, regulatory, and reputational impact.

Several seminal works have introduced rebalancing strategies in order to improve the predictive performances of generic classifiers [5, 21]. These strategies can be divided into two categories [24]: model-level strategies, that aim at adapting an existing algorithm, for example by weighting classes or minimizing a specific loss function [4, 19]; and data-level strategies, that act on the original data set by oversampling or undersampling the observations, and are thus model agnostic. A subclass of data-level strategies, named synthetic procedures, generates new samples in the minority class, with many variants introduced in the literature [5, 12, 10]. One key characteristic is that most of them are primarily designed to handle numerical features and thus do not handle categorical features [7, 26]. In practice, categorical features are very common in tabular data (e.g. job category, country, gender), and can represent a relevant signal for improving the predictive performances of the learning tasks, such as those described in [9, 8]. This highlights the importance of handling mixed features when generating samples for imbalance data. Besides, combination of several categorical variables need to be generated in a coherent way with each other and with respect to the continuous variables.

In this paper, we focus on synthetic rebalancing strategies for tabular data, with the main objective to handle mixed features. We emphasize that when generating categorical features, a major aspect is to ensure their intrinsic coherence and their association with continuous features. The notion of coherence aims at expressing that a combination of categorical variables can be judged as plausible by some business owner, such as a bank analyst. Indeed, generating samples that do not seem credible may lead to a reluctance to apply subsequent machine learning analyses, without mentioning the potential negative impact on the predictive performances. We define formally coherent combinations as the ones existing in the original samples. On the other hand, the association level measures the dependence between continuous and categorical features, via the accuracy of a given model trained to predict the categorical variables based on continuous variables. Thus, preserving the level of association between original and synthetic data ensures that the distribution of categorical variables conditional on continuous variables remains similar. An augmented data set that is coherent and preserves the association level compared to the original data has a distribution close to the original data set. Our main contributions are:

We introduce MGS-GRF, a strategy for mixed features, with a kernel density estimation for continuous ones and a generalized forest for categorical ones.

On simulated data, we prove that SMOTE-NC, probably the most widely used synthetic rebalancing strategy, is not coherent and does not preserve association, thus creating unplausible samples. On the contrary, our method satisfies these properties, thus creating more realistic samples.

We also show that both notions of coherence and association are positively correlated with predictive performances. Thus, creating implausible samples not only makes the models less trustworthy, but also reduces the performances.

We compare our proposed method with other rebalancing strategies on two banking public data sets and one private data set from a major financial institution. We show that our proposed strategy, MGS-GRF, which is both coherent and preserves association, has the best predictive performances.

Related work

We consider a data-set {(Xi,Yi)}i=1N constituted of N independent pairs, each one distributed as (X,Y). The random variable X takes values in ℝd×𝒳p while Y∈{0,1}, where 𝒳 is the space of categorical features. Here, without loss of generality, we assume that the first d features of X, denoted X1:d, are continuous, while the p others, denoted Xd:, are categorical. Similarly, we suppose that the n first samples are labeled Y=1, denoted {Xi}i=1n, verifying n<<N−n since we work in an imbalanced data setting.

All rebalancing strategies in the literature are divided into two parts, the first one handling the continuous features and the second one handling the categorical ones. Accordingly, we encompass all oversampling strategies in Algorithm 1, which describes the generation of a single synthetic example. Algorithm 1 may be run as many times as necessary to obtain the desired number of minority samples. The procedure starts by selecting uniformly at random c∈{1,…,n} and the corresponding minority sample Xc. Let NNK,L(Xc) be the set of the K∈ℕ∗ nearest neighbors of Xc among minority samples w.r.t. to a given norm L. Finally, ContinuousSampler and CategoricalSampler functions are applied if necessary. We present below the state-of-the art procedures using Algorithm 1.

SMOTE [5] is the most common synthetic procedure for generating continuous new samples in the minority class. Thus, SMOTE does not have a CategoricalSampler in Algorithm 1. To generate a new synthetic sample, an observation Xk is drawn uniformly at random among the K nearest neighbors of Xc w.r.t. the L2 norm. The synthetic sample generation is the following

𝙲𝚘𝚗𝚝𝚒𝚗𝚞𝚘𝚞𝚜𝚂𝚊𝚖𝚙𝚕𝚎𝚛(X1:dc,NNK,L2(Xc))=X1:dc+wX1:dk,

where w∼𝒰([0,1]) and with 𝒰 the uniform distribution. Note that SMOTE has several variants [10, 12], but, to the best of our knowledge, these variants are also originally designed for continuous input features only.

SMOTE-N is presented in the original paper introducing SMOTE [5]. This methodology is designed only for categorical input. SMOTE-N uses a version of the Value Difference Metric [27], denoted LVDM, as norm. More precisely, for two categorical vectors u,v∈𝒳p we have,

LVDM(uj,vj)=∑j=1pδ(uj,vj),

where δ(uj,vj)=2|pn(Y=0|Xj=uj)−pn(Y=0|Xj=vj)|. The value pn(Y=0|uj) is the empirical conditional probability that the output class is Y=0 given that the feature j has the value uj. Note that, in order to compute LVDM, the majority class samples are necessary. To generate a new observation, a sample is drawn uniformly among the minority samples. Then, its nearest neighbors according to LVDM are computed. Finally, the new minority sample is generated by a vote among the previous nearest neighbors along each variable. With Algorithm 1 notations:

𝙲𝚊𝚝𝚎𝚐𝚘𝚛𝚒𝚌𝚊𝚕𝚂𝚊𝚖𝚙𝚕𝚎𝚛(NNK,LVDM(Xc))=Vote(NNK,LVDM(Xc)),

where Vote(NNK,LVDM(Xc))j, is a vote among the nearest-neighbors for the categorical feature j∈{1,…,p}.

SMOTE-NC is designed to handle data sets containing both continuous and categorical features, and is also presented in the original SMOTE paper [5]. The main idea is to define a distance metric, denoted LNC, that takes into account the categorical features. To this aim, the median C∈ℝ of standard deviations of all continuous features for the minority class is computed. The LNC takes the form

LNC(X,X′)=∑j=1d(Xj′−Xj)2+C2∑j=d+1d+p𝟙Xj≠Xj′.

Then, continuous features are generated using SMOTE interpolation while categorical one are based on a nearest neighbors vote. For SMOTE-NC we have:

𝙲𝚘𝚗𝚝𝚒𝚗𝚞𝚘𝚞𝚜𝚂𝚊𝚖𝚙𝚕𝚎𝚛(X1:dc,NNK,LNC(Xc))=X1:dc+wX1:dkc,
𝙲𝚊𝚝𝚎𝚐𝚘𝚛𝚒𝚌𝚊𝚕𝚂𝚊𝚖𝚙𝚕𝚎𝚛(NNK,LNC(Xc))=Vote(NNK,LNC(Xc)),

SMOTE-ENC [21] applies the same procedure as SMOTE-NC except that LNC is replaced by

LENC(X,X′)=∑j=1d(Xj′−Xj)2+∑j=d+1d+pCj2𝟙Xj≠Xj′.

However, to the best of our knowledge, SMOTE-ENC has no implementation agnostic to the data-set, and in the original repository the computation of Cj differs for each data-set.

Our proposed algorithm: MGS-GRF

In this section, we describe our new algorithm to handle mixed data. It is organized similarly to Algorithm 1, so that we first describe our procedure to generate continuous features before detailing the categorical variables methodology.

Handling continuous features

Numerous studies have proposed Kernel Density Estimator (KDE) for generating synthetic samples within the minority class for continuous input features. Actually, SMOTE itself can be seen as a KDE with uniform kernel piece by piece [28]. For instance, [16, 17] introduce an oversampling strategy that, based on original samples, adds centered Gaussian noise with a unique diagonal scale matrix to original samples to generate new observations. [20] develops ROSE, a KDE based oversampling strategy which is associated to a unique scale matrix for the whole minority class. Later, [30] proposes a weighted sample KDE oversampling strategy with fixed diagonal scale matrix, thus isotropic, of the form h×I with h∈ℝ and I the identity matrix. h is as in Adasyn [12]: higher weights are given to original minority samples surrounded mostly by majority class samples.

Multivariate Gaussian SMOTE (MGS) is a synthetic procedure for continuous features introduced by [24]. MGS is presented as a variant of SMOTE that generate new samples from multivariate Gaussian distributions and no longer with a linear interpolation. We analyzed the MGS procedure and reformulate it as a Gaussian KDE from the sample smoothing estimator family [25], i.e. with several different full-rank local scale matrices. Furthermore, MGS do not assume the covariance matrix to be diagonal, thus not isotropic, which allows for better adaptivity to the unknown minority distribution. We choose to generate the continuous features of synthetic samples, Z1:d∈ℝd, according to the following density fˆMGS(Z1:d) fitted on the original minority samples {Xi}i=1,…,n:

fˆMGS(Z1:d)=1n∑i=1n1(2π)d/2|Σˆi|exp⁡(−12(Z1:d−μˆi)T(Σˆi)−1(Z1:d−μˆi)),(1)

where |Σˆi| denotes the determinant of Σˆi and

μˆi=1K∑X∈NNK,L2(Xi)X1:d,Σˆi=1K∑X∈NNK,L2(Xi)(X1:d−μˆi)(X1:d−μˆi)T

are estimated for each minority class sample using the K nearest-neighbors from the minority class, w.r.t. to L2 norm. We choose a value of K=d+1 in order to possibly obtain full-rank covariance matrices. Besides, Σi can be estimated using shrinkage [15, 6] or simply the sample covariance matrix [24], but empirically we got better results with the empirical covariance.

One notes that the underlying distribution of this sampling is a n Gaussian mixture with equal weights. We also remark that ROSE [20] corresponds to the special case where all Σi are equal.

Handling categorical data via Generalized Forests

Now, we introduce our selected procedure for generating synthetic categorical features. A first remark when looking at Algorithm 1 is that multi-output classifiers, such as nearest neighbors, can be used to generate the categorical features. Indeed, such models can be trained using only minority samples, aiming at predicting the categorical features {Xd:i}i=1n based on the continuous features {X1:di}i=1n. Denoting by gˆ such trained classifier, based on Algorithm 1, one can repeatedly generate categorical samples as

𝙲𝚊𝚝𝚎𝚐𝚘𝚛𝚒𝚌𝚊𝚕𝚂𝚊𝚖𝚙𝚕𝚎𝚛(Z1:d)=gˆ(Z1:d).

Our selected methodology to generate categorical variables relies on Generalized Random Forests (GRF) [1]. The main difference between a random forest [3] and a GRF, is that, given the new point, GRF assigns a probability to each training sample. These probabilities are derive from the frequency of the training samples to fall in the same leaf as the predicted sample. Finally, GRF can be used to estimate any quantity identified via local moment conditions.

We implemented our own version of GRF from the RandomForestClassifier class of scikit-learn [23]. In our algorithm, the derivate probabilities are used to draw predicted target from training target vectors (Yi). The predict procedure of our GRF is detailed in Algorithm 2. Besides, we try several default hyperparameters for our GRF and finally we keep the default values from RandomForestClassifier class of scikit-learn for the tree building. Furthermore, we do not apply the principle of honesty [2], and neither scale the target variables.

MGS-GRF

We now detail MGS-DRF, our new procedure that combines MGS and GRF as described above. It follows the three following steps. First, MGS is applied to generate the continuous features of the new synthetic samples. Then, a Generalized Random Forest (GRF) denoted by gˆGRF is trained on all the original minority samples with the continuous features {X1:di}i=1n as inputs and the categorical features {Xd:i}i=1n, as outputs. Finally, the trained GRF is used to build the categorical features based on the continuous ones generated in the first step. Using Algorithm 1 notations we have,

𝙲𝚘𝚗𝚝𝚒𝚗𝚞𝚘𝚞𝚜𝚂𝚊𝚖𝚙𝚕𝚎𝚛({X1:di}i=1n)=Z1:d∼fˆMGS
𝙲𝚊𝚝𝚎𝚐𝚘𝚛𝚒𝚌𝚊𝚕𝚂𝚊𝚖𝚙𝚕𝚎𝚛(Zd:)=gˆGRF(Z1:d).

Our proposed method enjoys the following properties: (i) GRF generates combinations of categorical features that are all from the original minority class. (ii) Due to tree building procedure, GRF may be able to use only the few continuous variables that are relevant to generate the categorical variables, thus ensuring a better correlation between continuous and categorical variables. (iii) The categorical features are generated directly from the continuous ones of the new sample. Thus, they are no longer based on the neighborhood of the central point.

Illustrations on simulated data

In the following, we describe our baselines before defining both coherence and associations. We illustrate these notions through numerical simulations (All our experiments are available at https://github.com/artefactory/mgs-grf).

Baselines

Now, we introduce different strategies to preprocess the original imbalanced data set. We denote by None strategy the procedure where no rebalancing strategy is applied. CW is the class-weighting strategy while Random Oversampling strategy (ROS) and Random Undersampling Strategy (RUS) are data-level approaches. We also include the synthetic procedure SMOTE-NC, with the default number of nearest neighbors equal to 5. There is no generic implementation of SMOTE-ENC, thus we do not include this strategy (see Section 2).

Besides, we introduce 3 synthetic baselines for our comparison. MGS-NC selects a central point Xc uniformly over minority samples. MGS distribution is used (see Equation 1) with Σˆi and μˆi computed on the K nearest neighbors NNLNC,K(Xc) of Xc w.r.t. the LNC norm. Then, each categorical variable is generated separately via a vote among the same neighbors. The second baseline, MGS-5NN, applies MGS on the continuous features, and builds the categorical ones using a k=5 nearest neighbors w.r.t. L2 norm as multi-output classifier gˆ (see Section 3.2). Similarly, MGS-1NN is the same procedure with k=1.

All strategies (except None) resample or generate observations so that each of the two classes contains the same number of observations (balanced data set).

Numerical illustrations of non-coherence notion

In our first experimental protocol, we want to analyze the distribution of categorical variables via the notion of coherence defined below.

Our main objectives are to detect non-coherent synthetic procedures and assess whether incoherent samples harm predictive performances. We define the coherence value, denoted Coh, by the proportion of coherent synthetic observations generated by a strategy, over all the synthetic data. If we denote by ng the number of generated samples Zd:ℓ, we have

Coh=1ng∑ℓ=1ng𝟙{Zd:ℓ∈𝒞Y=1}.

We note that strategies that generate categorical features one by one with a vote are not coherent, as they can mix original combinations. This applies to SMOTE-NC, MGS-NC and MGS-5NN. However, MGS-1NN copies the features of the nearest neighbor from the minority class, thus leading the combination to be originally present in the minority class. Similarly, GRF is coherent because it draws randomly a combination of categorical features from the minority class.

We will simulate a binary classification task data set such that class 0 is overrepresented, with d=9 continuous features and p=2 categorical ones. We denote by 𝒞=𝒟×ℰ the set of combinations of categorical features where 𝒟 (resp. ℰ) is the set of possible modalities for the first (resp. second) categorical features. Each categorical feature is composed of m modalities, i.e. |𝒟|=|ℰ|=m and |𝒞|=m2, and only m (out of m2) combinations of categorical features are present in the minority class, written 𝒞Y=1=m. Only the 3 informative continuous features and the categorical features are used for generating the target Y. Our procedure consists of the following steps:

Draw 5000 samples composed of d continuous features as follows X1:d=(X1,…,Xd)∼𝒩(0,Id).

Draw Z∈𝒞 such that

ℙ[Z=c|X1:d]=exp⁡(−θc⊤X1:3)∑ℓ∈𝒞exp⁡(−θℓ⊤X1:3),

with c ∈𝒞. The set of parameters Θ={θc,c∈𝒞}, verify, for all c∈𝒞, θc∈ℝ3. X1:3 are the 3 informative components of X, while other Xj values (j>3) do not impact Z value.

Draw the target variable Y such that

Y|X1:d,Z=c∼ℬ(σ(α⊤X1:3+γc)),

where ℬ is the Bernoulli distribution, σ is the logistic function and α∈ℝ3. The set of parameters Γ={γc,c∈𝒞} verify, for all c∈𝒞, γc∈ℝ. In order to limit the number of coherent combinations present in the minority class, we set high γc values only for m different combinations c∈𝒞. Besides, we choose α and all γc values such that the class Y=1 is underrepresented.

Return [X1,…,Xd,Z1,Z2,Y], where Z1∈𝒟,Z2∈ℰ satisfy Z=(Z1,Z2).

We fix the values of Θ, α and Γ once and for all and run the above protocol 50 times. Thus, we produce 50 data sets (with different random seeds), that we split into train and test set. We preprocess the train set with the different rebalancing strategies and train a LightGBM classifier on it. Predictive performances on the test set are displayed in Table 1.

In Table 1, we see that MGS-GRF and MGS-1NN have a coherence value Coh=100%, which is expected for these two coherent strategies. On the contrary, the non-coherent strategies (SMOTE-NC, MGS-NC and MGS-5NN) have coherence values lower than 100%, as they can generate minority samples whose categorical vectors are not found in the original data set. We observe that strategies with low Coh, i.e. creating non-coherent combinations of categorical features deteriorate the predictive performances of the final classifier. This is particularly visible for MGS-5NN and MGS-1NN, while being very similar models. In contrast, MGS-GRF achieves the best predictive performances in terms of both PR AUC and ROC AUC, with a computation time (for oversampling and LightGBM training) only 50% longer than SMOTE-NC. Finally, we remark that MGS-NC leads to better predictive performances than SMOTE-NC, indicating that MGS seems to better regenerate the distributions of the minority class than SMOTE.

We run our protocol with 6 configuration values for Θ,α,Γ. For each configuration, we apply the protocol above, so that we obtain in total 300 datasets. The PR AUC of the LightGBM classifier for each rebalancing strategy and for each data set is displayed in Figures 1(a) and 1(b), where each point corresponds to one of the 300 data sets. We display the PR AUC of a given rebalancing strategy in y-axis and the PR AUC of the None strategy in x-axis. Circles points are all associated to coherent strategies (MGS-1NN and our proposed strategy MGS-GRF), while the squares ones are associated to non-coherent ones (SMOTE-NC, MGS-5NN). We plot linear fitting curves and also add the first bisector in gray (line y=x).

In both figures, we remark that the points (both squares and circles) are above the first bisector, thus the rebalancing strategies lead to improvement of PR AUC. However, the average coherent strategies achieve higher PR AUC than the non-coherent ones. This difference is the highest when the PR AUC of the None strategy is the lowest (left side of the figures), which corresponds to more complex classification settings. In such difficult scenarios, non-coherent strategies have low Coh values, which may in turn explain their low PR AUC, close to that of the None strategy. When the learning task is easier, all strategies have similar performance (right side of the figures). All in all, this experiment shows that coherent strategies should be preferred to non-coherent ones, especially in more difficult classification problems.

Numerical illustrations of association notion

In the following, we define and present our numerical experiments on association.

We choose to measure the association level of a classifier via its accuracy on a leave-one-out validation on original minority samples. More precisely, if we write Zˆd:ℓ the prediction for X1:dℓ of a given classifier trained on {Xi}i≠ℓ (leave-one-out prediction), the association level Asso of this classifier is

Asso=1−(1n∑ℓ=1n𝟙{Xd:ℓ≠Zˆd:ℓ}−1n∑ℓ=1n𝟙{Xd:ℓ≠h∗(X1:di)}),

where h∗ is the Bayes classifier whose predictions are defined by h∗(X1:d)=arg⁡maxc∈𝒞⁡ℙ(Xd:=c|X1:d), with 𝒞 the set of combination of categorical features. In practice, we do not have access to the Bayes classifier, and thus to the association level. In such situations, the association level can also be estimated without the last term, that is with the classifier accuracy. Another point is that we focus on original minority points for which we have a ground truth Xd:i. While measuring on generated continuous features would be ideal given our oversampling objective (see Section 3.1), we do not have the ground truth for the categorical values of those points, and all reference data for measuring association are with the minority points.

In this second numerical experiments, we generate an imbalance binary classification data based on four input variables: 3 of them are continuous and the remaining one is categorical, with 3 modalities. We add d−3 continuous noise variables, which are independent of all previous variables. More precisely:

Draw 5000 samples as a mixture of 3 Gaussian in ℝ3: (X1,X2,X3)∼∑w=13πw𝒩(μw,Σw), with ∑w=13πw=1 and πw≥0. Let W∈{1,2,3} be the latent variable of the mixture s.t. (X1,X2,X3)|W∼𝒩(μW,ΣW).

Draw d−3 noise features: (X4,…,Xd)∼𝒩(μ2,λId−3) with λ∈ℝ∗.

Draw Z∈{‘‘A",‘‘B",‘‘C"} such that,

ℙ[Z=c|X1:d,W=w]=exp⁡(−ζc⊤X1:3+χw,c)∑ℓ∈𝒞exp⁡(−ζℓ⊤X1:3+χw,ℓ),

where ζc∈ℝ3 and χw,c∈ℝ. For each Gaussian, that is for each w∈{1,2,3}, we choose χw,c such that one modality is associated to the minority class. We emphasize that the notion of association between categorical and continuous features occurs at this step, where Z depends only on the 3 informative values X1:3 (W is a confounding variable) while others Xj(j>3) are pure noise.

Draw the target variable Y such that

Y|X1:d,W=w,Z=c∼ℬ(σ(β⊤X1:3+ηw+ϕc)),

where β∈ℝ3, and ηw,ϕc∈ℝ. One notes that Y depends on X1:3, while other Xj (j>3) are non-informative.

Return [X1,X2,X3,X4,…,Xd,Z,Y].

Following this protocol, we generate 8 data sets with increasing number of non-informative features d−3. On each of these 8 data sets, we estimate the association level of 3 multi-output classifiers: 1NN, 5NN and GRF. Since we are in a simulation setting, we have access to the Bayes predictor (see Section 0.B.2 for details), which allows us to compute the association level. We observe in Figure 2(a), that the association level of nearest neighbors (1NN and 5NN) decreases with increasing dimension, contrary to that of GRF which remains constant, and close to 1, this more accurately generating categorial features. As it is a known behavior for supervised tasks with many noisy uninformative features, nearest neighbors do not predict well the categorical feature.

We now study how the initial prediction task (predicting Y∈{0,1} based on continuous and categorical features) is impacted by the categorical feature generation. On each data set, we apply rebalancing strategies followed by LightGBM (with default hyperparameters) and compute its PR AUC. Results are depicted in Figure 2(b). We observe that all methods have the same performance for low dimensions. In this setting, the problem can be considered as easy (since the None strategy has good performances) and all rebalancing strategies are roughly equivalent, similarly to experiments implemented in Section 4.2.

As expected due to the curse of dimensionality, all performances degrade when the dimension increases, with the notable exception of our proposed method MGS-GRF, whose performances remain unaffected by the addition of noise variables. In fact, we see that the use of GRF compared to nearest neighbors (MGS-1NN or MGS-5NN) for generating categorical variables improves the final predictive performances. This finds explanation in the splitting procedure at work in GRF, which selects the variables that are the most predictive of the output (here the categorical input vector). On the contrary, nearest neighbors are unable to detect relevant variables for splitting, which explains their poor performances in high-dimensional settings.

We also note that SMOTE-NC, probably the default synthetic rebalancing strategy, is the worst in high dimensions, both in terms of mean value and standard deviation. On the opposite, our proposed method MGS-GRF exhibits the best performances with a small standard deviation. This seems to indicate that a good generation of categorical features (via GRF) leads to good predictive performance on the initial binary classification task.

(a).
(a). SMOTE-NC and MGS-GRF.
(a).
(a). Asso w.r.t. to dimension.

Experiments on real-world data sets

In this section, we describe all our numerical experiments on real-world data sets. We describe our protocol before commenting our results.

Data sets

We use two open source banking-related data sets, Bankmarketing [21] and Bankchurners [31], described in Table 2, both about bank customer behavior prediction. The first data set objective is to predict if a client subscribes to a banking offer after a phone marketing campaign. The second data set aims at predicting customer attrition from a financial institution. Both data set covariates contain historical records of the customers. To be closer to the challenge encountered in the private sector, we undersample the open source data set to have an imbalance ratio of 1%.

We also have a private data set, from a major bank, that contains clients information from one country in Europe. The purpose is to predict if a customer meets some criterion from historical records. The target criterion is beyond the scope of this paper. Positive cases predicted by the model are pushed to analysts, with corresponding explainability results, and the analysts have to make a decision based on the model output. Furthermore, analysts give feedbacks on the pertinence of pushed cases to the data science team, who retrain the model several times per year. A version from the ML-based system has been deployed and the high-level pipeline is described in Figure 3 in Appendix 0.A. The data set contains millions of anonymized customers and we recall that all process is done in compliance with the country’s regulatory requirements.

Evaluation

We evaluate the public data sets with the following protocol. For an iteration, the data set is evaluated through a 5 -fold cross validation, with Z-score scaling of the train set. We stress on the fact that each strategy is applied on the same training set. We run this protocol 20 times and averaged the metrics from each run. The private data set is evaluated through a temporal train/test split, with test set covering year 2023 and no overlap of clients between train and test sets. Tree-based models produce state-of-the-art performances on tabular data sets [9] and we choose LightGBM [13] as classifier due to its computational efficiency.

We introduce an evaluation metric, the precision at recall, denoted Pr-at-rec(x), which equals the precision associated to a recall of at least x, for any x∈[0,1]. This metric aims at representing an industrial or operational trade-off between precision and recall. After discussions with the analyst, we choose a recall x=0.2. We also use two usual aggregated metrics, the ROC AUC and the PR AUC. Results are displayed in Table 3.

Results

In Table 3, we first observe that oversampling strategies that preserve coherence (MGS-1NN and MGS-GRF) leads to better predictive performances than the non-coherent ones (SMOTE-NC, MGS-NC, MGS-5NN). Besides, we remark that SMOTE-NC induces the greatest deterioration of predictive performances, for example −28% of PR AUC on the private data set. Furthermore, MGS-NC strategy leads to better predictive performances than SMOTE-NC for all three data sets, reinforcing conclusions of [24]: the MGS KDE is better suited than SMOTE linear interpolation for minority class continuous features regeneration. We also see that our proposed method MGS-GRF has the best predictive performances for BankChurners and BankMarketing in Table 3 for all metrics, with a running time (for oversampling and LightGBM training) close to that of SMOTE-NC.

For the private data set, we observe that MGS-GRF and CW are the two best strategies (in italics). Those are promising results for our method and validate our findings of Section 4.2 and Section 4.3 on association and coherence. To take advantage of both strategies, we built an ensemble learning model CW × MGS-GRF combining the two LightGBM obtained after CW and MGS-GRF strategies. This methodology obtains the best results by far.

Conclusion and perspectives

In this paper, we propose an oversampling strategy, MGS-GRF which synthesizes continuous features with a kernel density estimator and categorical ones by a GRF. We show through our first experimental protocol with simulated data (Section 4.2), that coherent strategies (MGS-1NN and MGS-GRF) lead to better predictive performances in terms of PR AUC and ROC AUC. Then, in Section 4.3, we show that nearest-neighbor based oversampling strategies are not well suited to handle categorical variables, since they do not preserve the association of generated samples in the presence of noisy features.

We performed numerical experiments on two real-world open source data sets and an industrial private data set from a financial institution which is used in production. Our results show that MGS-GRF is the most promising strategy for real-world applications, achieving the best predictive performances. Thus, we recommend designing strategies are coherent and preserve association and, among those, we recommend the use of our proposed method MGS-GRF, which achieves the best predictive performances on real-world data sets.

Acknowledgements

We would like to express our gratitude to the following individuals for their valuable help and feedbacks: Vincent AURIAU, Mohamed CHTIBA, Jean-Baptiste JANVIER and Martin KLIEBER.

Next step

A problem worth researching?

Tell us what you are trying to solve, and we will put you in touch with the people who work on it.