3.1. Hierarchical Adaptive Sampling Algorithm
To address the approximation constraints on the sample subset
, we first perform a structured hierarchical partitioning of the original dataset
based on data distribution. Considering that industrial logs or behavioral data typically exhibit long-tail and class-imbalanced characteristics (e.g., high-frequency classes account for over 60% of tens of millions of samples), we adopt a joint partitioning strategy based on label distribution and feature density to divide the data into
subsets:
where:
denotes the
th hierarchical subset;
is the number of hierarchical levels (typically set to 10–50 to balance granularity and computational cost) [
4]. Based on this, sampling is performed independently for each level to form the subset
, and the overall sample set is
, with the sampling rate defined as:
where:
is the number of samples in layer
;
is the number of samples selected from that layer; and
represents the corresponding sampling ratio.
To prevent high-frequency layers from dominating the training process, during the initialization phase,
is set to be inversely proportional to the variance within the layer or the scarcity of classes. This implies that more weight is given to low density or high uncertainty areas in the sampling, thus increasing the boundary sample coverage [
5]. In the particular implementation, a lightweight statistical scan of the entire dataset is initially done (e.g., one MapReduce or batch processing) to compute the sample density and label distribution of each layer, and then produce an initial sampling rate vector according to predefined rules.
Figure 1 illustrates the process of sampling and layering. This process guarantees that a training subset is constructed that is both representativeness and computational controllable without having to go through the whole dataset, which serves as a stable point to further dynamic update methods.
3.2. Dynamic Sampling Rate Update Strategy
Upon the completion of the process of static stratification and initial sampling rate configuration, a dynamic update system that relies on a model feedback mechanism should be implemented in order to adjust to the time-dependent nature of data distributions. Since the data in a production setting is usually consumed in real time in either streaming or batching, a fixed sampling rate finds it hard to ensure repeated attention on important samples [
6]. Therefore, after each training cycle
, the sampling proportion of each stratified subset
is adjusted based on its contribution to model training. Specifically, using the change in stratified loss as a feedback signal, the update rule is defined as:
where:
denotes the sampling rate for the
th layer in the
th round;
is the learning step size, used to control the update magnitude (typically set to 0.01~0.1);
represents the change in loss calculated using only data from the
layer in the current round, used to measure the extent of that layer’s influence on model optimization;
denotes the number of layers; the denominator term
is used to normalize the update magnitude, preventing fluctuations in a single layer from causing unstable impacts on the overall sampling structure [
7].
During implementation, updates are completed without the need for additional full-scale computations by recording hierarchical gradients or local loss estimates during the training phase; simultaneously, upper and lower bounds are set for to prevent oversampling or sample dilution. The sampling process is converted into a closed-loop adjustment mechanism instead of a fixed allocation, which is more stable and better informed as the inputs of the feature selection step.
3.3. Mutual Information-Based Feature Selection
With stratified sampling and dynamic data filtering completed, the input data scale has been reduced, but the feature dimension may still remain high (e.g., 300–2,000 features in recommendation or log data). Therefore, key variables with strong predictive contribution should be further identified [
8]. In practice, each feature in the sampled subset is first discretized or estimated by kernel density to obtain a unified probability representation. As shown in
Figure 2, this step corresponds to the probability estimation and mutual information scoring stage. The mutual information between feature
and target variable
is defined as:
where:
is the joint probability distribution of feature values
and labels
;
are the corresponding marginal distributions;
characterizes the degree of information gain of the feature regarding the target variable.The obtained scores are used as the input of the feature ranking node in
Figure 2.
During the computation, by counting frequencies through a single pass over the data or using a mini-batch estimation strategy, all feature scoring can be completed within a time complexity of
.Subsequently, features are sorted in descending order based on
, and the top
high-information-content features are selected for the candidate set, where
is typically preset according to computational budget or model complexity constraints (e.g., 20%–40% of the original dimension) [
9]. This approach can quickly selectively remove low-relevance features without training a model, which offers an organized basis to subsequently apply sparsity constraints to further reduce redundancy.
3.4. Feature Identification with Sparsity Constraints
Following mutual information screening, the candidate feature set
generated by Eq. (6) is used as the input of the sparsity-constrained stage in
Figure 2. Although low-relevance features have been removed, strong correlations may still exist among candidate features, especially in industrial log data where features from the same source often have correlation coefficients greater than 0.7. Therefore, sparsity constraints are introduced to further reduce redundant dimensions.
In
Figure 2, this step corresponds to sparse weight optimization. A weight vector
is assigned to the candidate features, where mmm is the number of features in
.The optimization objective is formulated as:
where:
represents the selection weight for the
th feature;
is the
norm constraint term, which promotes a sparse distribution of the weight vector [
10].
The weights are updated during the solution process with either coordinate descent or proximal gradient method with a threshold truncation strategy which directly drops features with a weight below a set threshold, and the final feature subset is obtained.
Figure 2 shows this process. The approach is used to accomplish a shift between“correlation screening”and the problem of approximating optimum subsets, by integrating the modeling of information content evaluation and the sparsity constraints.
To improve reproducibility, the executable procedure of the proposed method is summarized in Algorithm 1.
Input:
Dataset D={(xi, yi)}i=1N, number of strata K, initial sampling rate r(0),
learning step η, candidate feature ratio q, sparsity threshold τ,
maximum iteration T.
Output:
Sampled subset S and selected feature subset F*.
1: Partition D into K strata {D1, D2, ..., DK} according to label distribution and feature density.
2: Initialize the sampling rate rk(0) for each stratum Dk.
3: for t = 1 to T do
4: Sample Sk(t) from each Dk according to rk(t).
5: Construct S(t)=∪k=1K Sk(t).
6: Train the model on S(t) and compute the stratum-level loss change ΔLk(t).
7: Update rk(t+1) using the dynamic sampling rule in Eq. (5).
8: end for
9: Compute the mutual information score I(fj; y) for each feature on S using Eq. (6).
10: Rank all features by I(fj; y) and retain the top q proportion as candidate set Fc.
11: Solve the sparsity-constrained optimization problem in Eq. (7).
12: Remove features with weights lower than τ.
13: Return S and F*.