How to fill missing values in time-ordered data correctly to preserve the temporal structure and improve machine learning quality.
What are time series?
DEFINITION
Time series are data ordered in time. In finance, manufacturing, IoT systems — wherever values change over time, we have a natural temporal dependency: every value is tied to the previous ones and influences future ones. The problem is that data is often incomplete: gaps, "zeros", or sensor failures. How do we work with that so the model sees a coherent, meaningful signal?
Why simple zero-filling is a bad idea
ZERO-FILL ARTIFACTS
Inserting zeros at the gaps creates abrupt jumps. This breaks the temporal structure, distorts statistics, and adds unnecessary "noise" to the signal spectrum. To the model, this looks like unpredictable anomalies rather than a smooth process.
Interpolation as restoring data logic
Interpolation is filling gaps based on known points.
The simplest option is linear interpolation: connect two known points with a straight line and take intermediate values via the formula x(t) = x₁ + (x₂ - x₁) × (t - t₁) / (t₂ - t₁)
In a financial series this means: between price 10 and price 15, three steps later, we get a smooth change 10 → 11.25 → 12.5 → 13.75 → 15.
What we preserve with interpolation
- Temporal structure: values change gradually, as in a real process.
- Statistical properties: mean, variance, autocorrelation stay closer to the originals.
- Frequency characteristics: no extra high-frequency artifacts from abrupt jumps.
- Information connectivity: neighboring points share more mutual information, improving model performance.
Why it matters for machine learning
FOR A MODEL WITH GAPS OR ZEROS
Gradients can zero out on those regions, slowing or stalling training. Forecast quality drops because the model learns from a distorted distribution.
WITH INTERPOLATION
Gradients remain continuous — the model gets a useful signal at every step. Convergence is more stable, with fewer random spikes in error.
Specifics of financial series
CRITICAL FEATURES
Volatility clusters — periods of high and low variability. Long-range dependencies — links between distant values. Cross-asset correlations — mutual influences between instruments.
In financial data, what matters:
Interpolation helps preserve these characteristics even where the original data was incomplete. This is especially critical for covariance estimation and portfolio strategies.
Practical interpolation methods
- Linear interpolation: connect two points with a straight line. Simple and effective for most cases.
- Polynomial interpolation: use higher-order polynomials for smoother transitions.
- Spline interpolation: cubic splines for smooth curves without oscillations.
- Statistical methods: ARIMA, exponential smoothing, or other temporal models for forecasting gaps.
x(t) = x₁ + (x₂ - x₁) × (t - t₁) / (t₂ - t₁)
Which method to use
Method — When to use — Advantages — Disadvantages Linear — Short gaps, smooth changes — Simplicity, speed, stability — Ignores nonlinearity Polynomial — Nonlinear trends, complex patterns — Flexibility, accuracy — Oscillations, overfitting Spline — Smooth transitions, visually pleasing — Smoothness, stability — Computational cost Statistical — Long gaps, seasonality — Accounts for temporal structure — Tuning complexity
Method selection checklist
- Short gaps (1-3 points): linear interpolation
- Nonlinear trends: polynomial or spline interpolation
- Long gaps: statistical methods (ARIMA, exponential smoothing)
- Financial data: account for volatility and clustering
- Seasonality: use methods that handle periodicity
Key takeaways
SUMMARY
Interpolation preserves the temporal structure of data, which is critical for ML models. The right method depends on data nature and gap length. Financial series demand special attention to volatility and correlations. Quality interpolation improves model convergence and training stability.