This is the code that accompanies the article posted on medium.
I will explain a method to create a density map from a limited number of coordinates, by estimating missing values using interpolation.
In this approach we first make a grid and then assign interpolated weights to each coordinate.
For the interpolation, three methods are explored:
- Creating a KNN algorithm using BallTree
- Using sklearn KNeighborsRegressor
- Nearest neighbours with griddata from scipy
Then we briefly summarize more advanced interpolation methods such as linear and cubic interpolation, and krigin.
This map is obtained using KNN and IDW.
Written by Frank Trioen on April 3th, 2023.