Author: Yu Huize
A data-driven pipeline for modeling and predicting 2D vector field dynamics using dimensionality reduction and multiple forecasting methods.
This project applies five data-driven approaches to learn the temporal evolution of a 2D velocity field (64×64 grid, 2 components) and compares their prediction performance:
| Model | Type | Description |
|---|---|---|
| DMD | Physics-informed (linear) | Dynamic Mode Decomposition — fits a linear operator via eigendecomposition |
| SINDy | Physics-informed (nonlinear) | Sparse Identification of Nonlinear Dynamics — discovers sparse polynomial ODEs |
| Ridge Regression | Machine learning (linear) | Autoregressive prediction with L2 regularization |
| MLP | Machine learning (nonlinear) | Two-hidden-layer neural network (64→32, tanh) |
| SVR | Machine learning (nonlinear) | Support Vector Regression with RBF kernel |
All models operate in a POD-reduced space (20 modes capturing 92.84% of fluctuation energy), reducing the original 8192-dimensional system for computational efficiency.
System-Modeling-and-Prediction/
├── pyproject.toml # Project metadata and dependencies
├── main.py # Full pipeline script (run all steps)
├── notebooks/
│ └── notebook.ipynb # Interactive Jupyter notebook with visualizations
├── src/
│ ├── config.py # Hyperparameters and paths
│ ├── data_loader.py # Data loading and preprocessing
│ ├── svd_reduction.py # SVD/POD decomposition and reconstruction
│ ├── dmd_model.py # DMD model implementation
│ ├── sindy_model.py # SINDy model implementation
│ ├── ml_models.py # Ridge, MLP, and SVR models
│ ├── evaluation.py # Metrics (RMSE, relative error, correlation)
│ └── visualization.py # Plotting utilities
├── data/
│ └── vector_64.npy # Raw vector field data (15000 snapshots)
├── figures/ # Generated plots
├── results/
│ └── summary.txt # Evaluation summary
└── docs/ # Documentation
- Python 3.10+
- NumPy
- SciPy
- Matplotlib
- scikit-learn
pip install .Or install with notebook support:
pip install .[notebook]python main.pyThis executes all steps sequentially: data loading → SVD/POD → model fitting (DMD, SINDy, Ridge, MLP, SVR) → evaluation → visualization. Results are saved to results/summary.txt and figures to figures/.
Open notebooks/notebook.ipynb in Jupyter for step-by-step exploration with inline plots and discussion.
- Data Loading & Preprocessing — Load 15,000 snapshots of a 64×64×2 velocity field; compute temporal mean and fluctuations
- SVD/POD Decomposition — Extract dominant spatial modes; reduce from 8,192 to 20 dimensions
- Model Fitting — Train five models on POD temporal coefficients (train set: 10,500 snapshots)
- Evaluation — Predict on validation (2,250) and test (2,250) sets; compute RMSE, relative error, and Pearson correlation
- Sliding Window Evaluation — Assess prediction accuracy at multiple horizons (1, 5, 10, 25, 50, 100, 200 steps)
| Model | RMSE | Rel. Error | Correlation | Fit Time |
|---|---|---|---|---|
| Ridge | 0.7632 | 1.0113 | 0.1636 | 0.07s |
| MLP | 1.0209 | 1.3729 | -0.0649 | 6.44s |
| SVR | 1.1336 | 1.5127 | -0.0500 | 96.36s |
| DMD | 1.8487 | 2.1707 | -0.2035 | 0.01s |
| SINDy | 2.5648 | 3.3436 | 0.1366 | 0.14s |
- Ridge Regression achieves the best overall accuracy across all horizons
- DMD is the fastest to fit and produces bounded predictions but loses phase alignment
- SINDy provides the most interpretable model (explicit governing equations) but diverges long-term
- No model achieves reliable prediction beyond ~50 time steps for this chaotic system
Key parameters can be adjusted in src/config.py:
| Parameter | Default | Description |
|---|---|---|
N_MODES |
20 | Number of POD modes retained |
SINDY_N_MODES |
10 | Number of modes used in SINDy |
ML_LOOKBACK |
10 | Lookback window for ML models |
SINDY_THRESHOLD |
0.005 | Sparsity threshold for SINDy (STLSQ) |
SINDY_POLY_ORDER |
2 | Polynomial order for SINDy library |
DT |
0.2 | Simulation time step |