In [210]:
from fig_utils import *
import matplotlib.pyplot as plt
import time
%matplotlib inline
In this experiment, we compare the performance of models trained in-country with models trained out-of-country.
The parameters needed to produce the plots for Panels A and B are as follows:
For 10 trials, the LSMS plot should take around 5 minutes and the DHS plot should take around 15 minutes.
Each data directory should contain the following 4 files:
Each data directory should also contain one of the following:
Exact results may differ slightly with each run due to randomly splitting data into training and test sets.
In [206]:
# Parameters
country_names = ['nigeria', 'tanzania', 'uganda', 'malawi', 'pooled']
country_paths = ['../data/output/LSMS/nigeria/',
'../data/output/LSMS/tanzania/',
'../data/output/LSMS/uganda/',
'../data/output/LSMS/malawi/',
'../data/output/LSMS/pooled/']
survey = 'lsms'
dimension = 100
k = 10
trials = 10
points = 30
alpha_low = -2
alpha_high = 5
cmap = 'Greens'
In [207]:
t0 = time.time()
performance_matrix = evaluate_models(country_names, country_paths, survey,
dimension, k, trials, points,
alpha_low, alpha_high, cmap)
t1 = time.time()
print 'Time elapsed: {} seconds'.format(t1-t0)
print 'Corresponding values:'
print performance_matrix
In [208]:
# Parameters
country_names = ['nigeria', 'tanzania', 'uganda', 'malawi', 'rwanda',
'pooled']
country_paths = ['../data/output/DHS/nigeria/',
'../data/output/DHS/tanzania/',
'../data/output/DHS/uganda/',
'../data/output/DHS/malawi/',
'../data/output/DHS/rwanda/',
'../data/output/DHS/pooled/']
survey = 'dhs'
dimension = 100
k = 10
trials = 10
points = 30
alpha_low = -2
alpha_high = 5
cmap = 'Blues'
In [209]:
t0 = time.time()
performance_matrix = evaluate_models(country_names, country_paths, survey,
dimension, k, trials, points,
alpha_low, alpha_high, cmap)
t1 = time.time()
print 'Time elapsed: {} seconds'.format(t1-t0)
print 'Corresponding values:'
print performance_matrix
In [ ]: