Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
261 changes: 95 additions & 166 deletions calib_nb.ipynb

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions calibration/calib_main_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,12 @@ def estim_util_func_param(data_number_formal, data_income_group,
# NB: choice has to do with relevance and exogeneity of variables
# Choice set is relevant but may only refer to a small subset of locations
# (train stations are often dysfunctional, for instance)
variables_regression = [
'distance_distr_parks', 'distance_ocean', 'distance_ocean_2_4',
'distance_urban_herit', 'airport_cone2', 'slope_1_5', 'slope_5',
'distance_biosphere_reserve', 'distance_train']
variables_regression = amenities_sp.columns

# [
# 'distance_distr_parks', 'distance_ocean', 'distance_ocean_2_4',
# 'distance_urban_herit', 'airport_cone2', 'slope_1_5', 'slope_5',
# 'distance_biosphere_reserve', 'distance_train']

# We run the parameter scanning.
# Note that this may be long to run as it depends on the combination of all
Expand Down
23 changes: 21 additions & 2 deletions calibration/sub/import_amenities.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,32 @@ def import_exog_amenities(path_data, path_precalc_inp, dim):
amenity_data.distance_power_station < 2,
amenity_data.distance_biosphere_reserve < 2])
),
columns=['distance_distr_parks', 'distance_ocean',
'distance_ocean_2_4', 'distance_world_herit',
columns=['distance_distr_parks', 'distance_ocean','distance_ocean_2_4',
'distance_world_herit',
'distance_world_herit_2_4', 'distance_urban_herit',
'distance_UCT', 'airport_cone2', 'slope_1_5', 'slope_5',
'distance_train', 'distance_protected_envir',
'distance_protected_envir_2_4', 'RDP_proximity',
'distance_power_station', 'distance_biosphere_reserve']
)

# these are the amenities which feed into the model
keep = [
'distance_distr_parks', 'distance_ocean', 'distance_ocean_2_4',
'distance_urban_herit', 'airport_cone2', 'slope_1_5', 'slope_5',
'distance_biosphere_reserve', 'distance_train']
table_amenities = table_amenities[keep]


# # these new columns have been added to the amenities for testing
# newAmmenities=['publicHealthCare', 'privateHealthcare', 'sportsgrounds',
# 'publicHighSchool', 'independentHighSchool', 'HighmastLight']
# table_amenities[newAmmenities]=amenity_data[newAmmenities].astype(int)

return table_amenities

if __name__=="__main__":
import os
os.chdir('..')
out=import_exog_amenities("Data/data_Cape_Town/", 'Data/precalculated_inputs/', dim="SP")