KNN Accessibility
· 2 min read
KNNA (KNN Accessibility Score)
- is the lowest-cost path distance between origin and destination in network .
- is the weight of destination j, and the function of distance between i and j in the denominator represents an exponential distance decay rate that is controlled by parameter .
- is a predefined coefficient for the K-th nearest destination, given in an array of the form [0.5, ..., 0.1]. For example, a white paper published by WalkScore. uses the following arrays for each type of commercial amenity:
amenity_weight = {
"grocery": [3],
"restaurants": [.75, .45, .25, .25, .225,
.225, .225, .225, .2, .2],
"shopping": [.5, .45, .4, .35, .3],
"coffee": [1.25, .75],
"banks": [1],
}
- We have added an optional radius (e.g. 400 meters) to the index: a baseline distance from origin i in which no distance decay is applied and destinations contribute their full weights towards the index. This allows treating all nearby destinations as equally accessible. The radius can be set to zero to ensure that distance decay is always included. If the distance is greater than or equal to the search radius, it has no effect.
# https://github.com/City-Form-Lab/madina/blob/main/src/madina/una/betweenness.py
knn_weight = 0
for neighbor_weight, neighbor_distance in zip(self.network.knn_weight,d_idxs.values()):
if neighbor_distance < self.network.knn_plateau:
knn_weight += neighbor_weight
else:
knn_weight += neighbor_weight / pow(math.e, (beta * (neighbor_distance-self.network.knn_plateau)))