Introduction This notebook provides a simple example of the application of XGBoost Spatial Interaction model in python. For the purposes of this tutorial I will expect you to have some knowledge of Spatial Interaction Models and their purpose as well as some python skills. Yet, if you want to refresh a little or wish to learn, here is a list of relevant sources.
Watch Maarten Vanhoof talking about what are the spatial Interaction Models and how they can be used here (6 min) Have a look at a list of some relevant literature in different fields here Look at the example of Spatial Interaction Model application in R from Adam Dennett Part1 and Part2 Look at how you can apply the the same method in python with SpInt package So what is the XGBoost?
# we will first import all necessary libraries import pandas as pd import os import numpy as np import glob from datetime import datetime import geopandas as gpd import matplotlib.pyplot as plt import seaborn as sns import plotly.express as px from shapely.geometry import Point, LineString #from mpl_toolkits.basemap import Basemap import osmnx as ox import networkx as nx import matplotlib as mpl from networkx.algorithms import bipartite as bi import statsmodels.api as sm from scipy import stats from statsmodels.
Do you have an Origin-Destination data, you want to crack on with Spatial Interaction Models, but you dont know the distances between Origins and destinations? This post will show you how to calculate them. You're welcomed.
Introduction What do I do here? This post is an exploration of the UK intra-migration data. Those are open source data that can be downloaded from ONS. ONS uses the NHS Patient Register Data Service (PRDS) to find out the changes in patients adresses. Since most people change their address with their doctor soon after moving, these data are considered to provide a good proxy indicator of migration.
The migration data is published every year and consist of Origin Local Authority ID, Destination Local Authority ID, sex, age and movement factor field.