InseeFrLab / InseeFrLab/benchmark_spatial_interpolation
Summary and program
- Dominant language
- Jupyter Notebook
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
### 1. Progress to date
* **Folder Setup:** Created a project folder containing our current work, including the three algorithms we **found** and some bonus in case of needing, and ensured they all run on the same dataset. Providing a first output thanks to `AMR/output/map.py`
* **Algorithm Summaries:** Wrote summaries for each of the algorithms used.
* **Quarto Document:** Started the Quarto document that will serve as the final project report and drafted an initial structure.
---
Work done on B&C algorithms :
# GitHub Issue Content
## 0) Where I Found the Thesis
https://repository.tudelft.nl/record/uuid:50e2609e-644d-4241-b3f2-a17f204d2c06
## 1) Where I Found the Code
Section 4.4 of the thesis contains a link to the GitHub repository: https://github.com/leowlk/RF_Terrain/tree/main
From this repository, I downloaded only the essential files needed to run the code:
- `interpolation.py`
- `random_forest.py`
These files remain unmodified and are identical to those in the linked GitHub repository.
**`interpolation.py`** is a library implementing classical spatial interpolation methods (TIN, Laplace, Natural Neighbor, Inverse Distance Weighting) using startinpy and pyinterpolate. It creates regular grids from sparse 3D points, handles missing values through KNN imputation, and exports results as GeoTIFF files, providing traditional alternatives to machine learning methods for benchmark comparison.
**`random_forest.py`** is a reusable library implementing the Regression class with three machine learning algorithms (sklearn's Random Forest, Ranger Forest, and XGBoost) for spatial interpolation. It manages the complete workflow including data preprocessing, feature engineering, train/test split, model training, and performance evaluation using quantitative metrics (MSE, R², Max Error). The library exports predictions as georeferenced GeoTIFF files and serves as the central toolbox used by the executable scripts.
## 2) Files I Created
I created three additional files:
- `main_rf.py`
- `main_xgb.py`
- `map.py`
**`main_rf.py`** is an executable script that loads synthetic data, runs the Random Forest model using the Regression class from random_forest.py, and saves predictions as a GeoTIFF file. It functions as a configurable "RUN button" that separates task execution from the reusable library containing the model logic.
**`main_xgb.py`** is an executable script that loads the same synthetic data as main_rf.py but runs XGBoost instead of Random Forest. It uses the xgboost_RFregression() method from the Regression class and saves predictions as a separate GeoTIFF file, enabling direct performance comparison between the two algorithms.
**`map.py`** is a visualization script that reads the original training data and the GeoTIFF files generated by both models. It creates matplotlib plots to visually compare sparse training points with the continuous interpolated surfaces produced by the two models, allowing qualitative evaluation through side-by-side maps with terrain colormap.
The purpose of creating these files was simple: visualize the results of two different methods both quantitatively and visually.
## 3) Dataset Creation
I then created two CSV files: `iceDF_synthetic.csv` and `gridDF_synthetic.csv`. These names maintain clarity and consistency throughout the code.
**`iceDF_synthetic.csv`** is a synthetic training dataset containing sparse points with geographic coordinates (latitude and longitude) and the target value h_te_interp (likely terrain elevation or ice thickness). This dataset is used to train the Random Forest and XGBoost models for spatial interpolation.
**`gridDF_synthetic.csv`** contains a regular grid of geographic coordinates (latitude and longitude) without target values. The trained models use this grid to predict interpolated values and generate the continuous surface exported as GeoTIFF.
These are synthetic datasets created solely to test whether the algorithms work correctly.
## 4) How to Run the Code
With all files ready, you can run the code in this order:
1. **`main_rf.py`** - returns Random Forest results
2. **`main_xgb.py`** - returns Gradient Boosting results
3. **`map.py`** - visualizes and compares the results from both models
## 5) The Results
The model results are excellent, predicting points almost perfectly. For quick comparison, I used three metrics: MSE (in square meters), R², and maximum error (in meters).
The RMSE is approximately 5 meters, meaning the average prediction error is only 5 meters - fantastic.
## 6) Final Notes
Both methods work very well with minimal error. However, several factors likely contributed to these strong results: the synthetic data are highly correlated (nearby points are very similar), and the dataset has relatively few rows.
To properly evaluate these methods, they should be tested under more challenging conditions, including missing data, more complex terrain, and larger datasets.
---
### 2. Next Steps
* **Metrics Selection:** Define key metrics for evaluation (e.g., efficiency, processing time, and precision).
* **Benchmarking:** Compare algorithm performance using both synthetic and real datasets (adjusting our approach based on initial results, and creating other synthetic dataset).
* **Finalizing the Report:** Complete the Quarto document, focusing on the written analysis and data visualization.
### 3. Current Issues
* **Data Access:** We are currently unable to access the datasets you provided on sspcloud due to authorization. A quick tutorial or a brief call to resolve this would be very helpful.
### Feedback
Please feel free to share your thoughts on the metrics we should prioritize or any feedback you have on our progress so far. Your input would be greatly appreciated.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.