Skip to main content
. 2026 Sep 9;26(18):5740. doi: 10.3390/s26185740
Algorithm 1 Linear Trend Fitting and Deterministic Residual-Feature Engineering: Pipeline A

Require: Preprocessed, station-grouped dataset Dpre; target y; window sizes K={6,12}; MI top-K

Ensure: Linear model glin; residual targets r; selected feature set Xdet; ranked MI scores

 Rolling Features (station-grouped): For each station s, variable z, and  k∈K, compute rolling mean μt(k) and rolling std σt(k) using Equations (7) and (8) within station s only (rolling and lag features for target-derived variables use strictly past observations {t−1,…,t−k} only; see Section 3.4)

 Remove missing values; construct full deterministic feature matrix X

 Fit Linear Trend: glin← OLS regression of y on X (training partition only), using Equation (5)

 Compute Residual: rt←yt−glin(xt) for all t, using Equation (6)

 MI Scoring: Compute MIi=I(Xi;r) for each feature using Equation (9)

 Feature Selection: Sort by MIi descending; retain top-K features: Xdet←X[top-K]

 return glin, r, Xdet