Note
Go to the end to download the full example code.
Cross-nested logit¶
Estimation of a cross-nested logit model using sampling of alternatives.
Michel Bierlaire Sat Jul 26 2025, 14:57:17
import pandas as pd
from IPython.core.display_functions import display
import biogeme.biogeme_logging as blog
from alternatives import (
ID_COLUMN,
all_alternatives,
alternatives,
asian_and_downtown,
only_asian,
only_downtown,
partitions,
)
from biogeme.biogeme import BIOGEME
from biogeme.expressions import Beta
from biogeme.nests import NestsForCrossNestedLogit, OneNestForCrossNestedLogit
from biogeme.results_processing import get_pandas_estimated_parameters
from biogeme.sampling_of_alternatives import (
ChoiceSetsGeneration,
GenerateModel,
SamplingContext,
generate_segment_size,
)
from compare import compare
from specification_sampling import V, combined_variables
logger = blog.get_screen_logger(level=blog.INFO)
PARTITION = 'downtown'
MEV_PARTITION = 'uniform_asian_or_downtown'
SAMPLE_SIZE = 10 # out of 100 alternatives
SAMPLE_SIZE_MEV = 63 # out of 63 alternatives
CHOICE_COLUMN = 'cnl_3'
MODEL_NAME = f'cnl_{SAMPLE_SIZE}_{SAMPLE_SIZE_MEV}'
FILE_NAME = f'{MODEL_NAME}.dat'
the_partition = partitions.get(PARTITION)
if the_partition is None:
raise ValueError(f'Unknown partition: {PARTITION}')
segment_sizes = list(
generate_segment_size(SAMPLE_SIZE, the_partition.number_of_segments())
)
We use all alternatives in the nest.
mev_partition = partitions.get(MEV_PARTITION)
if mev_partition is None:
raise ValueError(f'Unknown partition: {MEV_PARTITION}')
mev_segment_sizes = [
SAMPLE_SIZE_MEV,
]
Nests
Downtown
mu_downtown = Beta('mu_downtown', 1, 1, None, 0)
downtown_alpha_dict = {i: 0.5 for i in asian_and_downtown} | {
i: 1 for i in only_downtown
}
downtown_nest = OneNestForCrossNestedLogit(
nest_param=mu_downtown, dict_of_alpha=downtown_alpha_dict, name='downtown'
)
Asian
mu_asian = Beta('mu_asian', 1, 1, None, 0)
asian_alpha_dict = {i: 0.5 for i in asian_and_downtown} | {i: 1.0 for i in only_asian}
asian_nest = OneNestForCrossNestedLogit(
nest_param=mu_asian, dict_of_alpha=asian_alpha_dict, name='asian'
)
cnl_nests = NestsForCrossNestedLogit(
choice_set=all_alternatives,
tuple_of_nests=(downtown_nest, asian_nest),
)
The following elements do not appear in any nest and are assumed each to be alone in a separate nest: {2, 4, 5, 6, 8, 10, 12, 16, 19, 21, 23, 25, 26, 28, 29, 35, 39, 41, 42, 43, 44, 52, 53, 58, 59, 62, 64, 65, 66, 67, 69, 71, 73, 82, 85, 95, 96}. If it is not the intention, check the assignment of alternatives to nests.
observations = pd.read_csv('obs_choice.dat')
context = SamplingContext(
the_partition=the_partition,
sample_sizes=segment_sizes,
individuals=observations,
choice_column=CHOICE_COLUMN,
alternatives=alternatives,
id_column=ID_COLUMN,
biogeme_file_name=FILE_NAME,
utility_function=V,
combined_variables=combined_variables,
mev_partition=mev_partition,
mev_sample_sizes=mev_segment_sizes,
cnl_nests=cnl_nests,
)
logger.info(context.reporting())
Size of the choice set: 100
Main partition: 2 segment(s) of size 46, 54
Main sample: 10: 5/46, 5/54
Nbr of MEV alternatives: 63
MEV partition: 1 segment(s) of size 63
MEV sample: 63: 63/63
the_data_generation = ChoiceSetsGeneration(context=context)
the_model_generation = GenerateModel(context=context)
biogeme_database = the_data_generation.sample_and_merge(recycle=False)
Generating 10 + 63 alternatives for 10000 observations
0%| | 0/10000 [00:00<?, ?it/s]
0%| | 17/10000 [00:00<01:00, 166.36it/s]
0%| | 34/10000 [00:00<01:00, 164.24it/s]
1%| | 51/10000 [00:00<01:00, 163.86it/s]
1%| | 68/10000 [00:00<01:00, 164.23it/s]
1%| | 85/10000 [00:00<01:00, 163.11it/s]
1%| | 102/10000 [00:00<01:00, 162.82it/s]
1%| | 119/10000 [00:00<01:00, 162.41it/s]
1%|▏ | 136/10000 [00:00<01:00, 162.09it/s]
2%|▏ | 153/10000 [00:00<01:00, 162.63it/s]
2%|▏ | 170/10000 [00:01<01:00, 163.06it/s]
2%|▏ | 187/10000 [00:01<01:00, 163.47it/s]
2%|▏ | 204/10000 [00:01<00:59, 163.74it/s]
2%|▏ | 221/10000 [00:01<00:59, 164.07it/s]
2%|▏ | 238/10000 [00:01<00:59, 164.43it/s]
3%|▎ | 255/10000 [00:01<00:59, 164.69it/s]
3%|▎ | 272/10000 [00:01<00:59, 164.50it/s]
3%|▎ | 289/10000 [00:01<00:59, 164.54it/s]
3%|▎ | 306/10000 [00:01<00:58, 164.72it/s]
3%|▎ | 323/10000 [00:01<00:58, 164.37it/s]
3%|▎ | 340/10000 [00:02<00:58, 164.78it/s]
4%|▎ | 357/10000 [00:02<00:58, 164.91it/s]
4%|▎ | 374/10000 [00:02<00:58, 165.07it/s]
4%|▍ | 391/10000 [00:02<00:58, 164.75it/s]
4%|▍ | 408/10000 [00:02<00:58, 164.17it/s]
4%|▍ | 425/10000 [00:02<00:58, 164.29it/s]
4%|▍ | 442/10000 [00:02<00:58, 164.54it/s]
5%|▍ | 459/10000 [00:02<00:57, 164.60it/s]
5%|▍ | 476/10000 [00:02<00:57, 164.44it/s]
5%|▍ | 493/10000 [00:03<00:57, 164.59it/s]
5%|▌ | 510/10000 [00:03<00:57, 164.53it/s]
5%|▌ | 527/10000 [00:03<00:57, 164.60it/s]
5%|▌ | 544/10000 [00:03<00:57, 164.71it/s]
6%|▌ | 561/10000 [00:03<00:56, 165.72it/s]
6%|▌ | 579/10000 [00:03<00:55, 168.63it/s]
6%|▌ | 597/10000 [00:03<00:55, 170.65it/s]
6%|▌ | 615/10000 [00:03<00:54, 172.00it/s]
6%|▋ | 633/10000 [00:03<00:54, 172.58it/s]
7%|▋ | 651/10000 [00:03<00:53, 173.38it/s]
7%|▋ | 669/10000 [00:04<00:53, 174.00it/s]
7%|▋ | 687/10000 [00:04<00:53, 174.28it/s]
7%|▋ | 705/10000 [00:04<00:53, 174.03it/s]
7%|▋ | 723/10000 [00:04<00:53, 173.32it/s]
7%|▋ | 741/10000 [00:04<00:53, 173.88it/s]
8%|▊ | 759/10000 [00:04<00:52, 174.42it/s]
8%|▊ | 777/10000 [00:04<00:52, 174.87it/s]
8%|▊ | 795/10000 [00:04<00:52, 175.35it/s]
8%|▊ | 813/10000 [00:04<00:52, 175.45it/s]
8%|▊ | 831/10000 [00:04<00:52, 174.98it/s]
8%|▊ | 849/10000 [00:05<00:52, 175.10it/s]
9%|▊ | 867/10000 [00:05<00:52, 175.26it/s]
9%|▉ | 885/10000 [00:05<00:51, 175.44it/s]
9%|▉ | 903/10000 [00:05<00:51, 175.26it/s]
9%|▉ | 921/10000 [00:05<00:51, 175.30it/s]
9%|▉ | 939/10000 [00:05<00:51, 175.17it/s]
10%|▉ | 957/10000 [00:05<00:51, 175.10it/s]
10%|▉ | 975/10000 [00:05<00:51, 175.15it/s]
10%|▉ | 993/10000 [00:05<00:51, 175.19it/s]
10%|█ | 1011/10000 [00:05<00:51, 175.16it/s]
10%|█ | 1029/10000 [00:06<00:51, 175.26it/s]
10%|█ | 1047/10000 [00:06<00:51, 175.34it/s]
11%|█ | 1066/10000 [00:06<00:50, 177.40it/s]
11%|█ | 1085/10000 [00:06<00:49, 179.60it/s]
11%|█ | 1103/10000 [00:06<00:49, 179.15it/s]
11%|█ | 1122/10000 [00:06<00:49, 179.62it/s]
11%|█▏ | 1141/10000 [00:06<00:49, 180.09it/s]
12%|█▏ | 1160/10000 [00:06<00:48, 180.70it/s]
12%|█▏ | 1179/10000 [00:06<00:48, 180.80it/s]
12%|█▏ | 1198/10000 [00:07<00:48, 181.62it/s]
12%|█▏ | 1217/10000 [00:07<00:48, 181.27it/s]
12%|█▏ | 1236/10000 [00:07<00:48, 180.08it/s]
13%|█▎ | 1255/10000 [00:07<00:48, 181.39it/s]
13%|█▎ | 1274/10000 [00:07<00:47, 182.51it/s]
13%|█▎ | 1293/10000 [00:07<00:47, 183.24it/s]
13%|█▎ | 1312/10000 [00:07<00:47, 183.55it/s]
13%|█▎ | 1331/10000 [00:07<00:47, 183.95it/s]
14%|█▎ | 1350/10000 [00:07<00:46, 184.31it/s]
14%|█▎ | 1369/10000 [00:07<00:46, 184.58it/s]
14%|█▍ | 1388/10000 [00:08<00:46, 184.91it/s]
14%|█▍ | 1408/10000 [00:08<00:45, 187.64it/s]
14%|█▍ | 1428/10000 [00:08<00:45, 189.62it/s]
14%|█▍ | 1448/10000 [00:08<00:44, 190.36it/s]
15%|█▍ | 1468/10000 [00:08<00:44, 190.87it/s]
15%|█▍ | 1488/10000 [00:08<00:44, 191.21it/s]
15%|█▌ | 1508/10000 [00:08<00:44, 190.70it/s]
15%|█▌ | 1528/10000 [00:08<00:44, 190.19it/s]
15%|█▌ | 1548/10000 [00:08<00:44, 189.05it/s]
16%|█▌ | 1567/10000 [00:08<00:44, 188.69it/s]
16%|█▌ | 1586/10000 [00:09<00:45, 186.10it/s]
16%|█▌ | 1605/10000 [00:09<00:45, 185.21it/s]
16%|█▌ | 1624/10000 [00:09<00:45, 185.29it/s]
16%|█▋ | 1643/10000 [00:09<00:44, 185.82it/s]
17%|█▋ | 1662/10000 [00:09<00:44, 185.50it/s]
17%|█▋ | 1681/10000 [00:09<00:45, 183.03it/s]
17%|█▋ | 1700/10000 [00:09<00:45, 183.55it/s]
17%|█▋ | 1719/10000 [00:09<00:45, 182.41it/s]
17%|█▋ | 1738/10000 [00:09<00:45, 180.30it/s]
18%|█▊ | 1757/10000 [00:10<00:46, 177.27it/s]
18%|█▊ | 1775/10000 [00:10<00:46, 175.47it/s]
18%|█▊ | 1793/10000 [00:10<00:46, 174.85it/s]
18%|█▊ | 1811/10000 [00:10<00:46, 174.28it/s]
18%|█▊ | 1829/10000 [00:10<00:47, 172.56it/s]
18%|█▊ | 1847/10000 [00:10<00:47, 172.59it/s]
19%|█▊ | 1865/10000 [00:10<00:47, 170.25it/s]
19%|█▉ | 1883/10000 [00:10<00:48, 168.10it/s]
19%|█▉ | 1900/10000 [00:10<00:48, 166.87it/s]
19%|█▉ | 1917/10000 [00:10<00:48, 165.95it/s]
19%|█▉ | 1934/10000 [00:11<00:48, 165.66it/s]
20%|█▉ | 1951/10000 [00:11<00:48, 165.48it/s]
20%|█▉ | 1968/10000 [00:11<00:48, 165.22it/s]
20%|█▉ | 1985/10000 [00:11<00:48, 165.27it/s]
20%|██ | 2002/10000 [00:11<00:48, 165.42it/s]
20%|██ | 2019/10000 [00:11<00:48, 165.39it/s]
20%|██ | 2036/10000 [00:11<00:48, 164.95it/s]
21%|██ | 2053/10000 [00:11<00:48, 164.77it/s]
21%|██ | 2070/10000 [00:11<00:48, 164.88it/s]
21%|██ | 2087/10000 [00:12<00:47, 165.05it/s]
21%|██ | 2104/10000 [00:12<00:47, 165.20it/s]
21%|██ | 2121/10000 [00:12<00:47, 165.38it/s]
21%|██▏ | 2138/10000 [00:12<00:47, 165.58it/s]
22%|██▏ | 2155/10000 [00:12<00:47, 165.76it/s]
22%|██▏ | 2172/10000 [00:12<00:47, 165.88it/s]
22%|██▏ | 2189/10000 [00:12<00:47, 165.92it/s]
22%|██▏ | 2207/10000 [00:12<00:46, 167.72it/s]
22%|██▏ | 2225/10000 [00:12<00:46, 168.58it/s]
22%|██▏ | 2243/10000 [00:12<00:45, 170.63it/s]
23%|██▎ | 2261/10000 [00:13<00:44, 172.21it/s]
23%|██▎ | 2279/10000 [00:13<00:44, 173.08it/s]
23%|██▎ | 2297/10000 [00:13<00:44, 173.92it/s]
23%|██▎ | 2315/10000 [00:13<00:44, 172.45it/s]
23%|██▎ | 2333/10000 [00:13<00:44, 173.05it/s]
24%|██▎ | 2351/10000 [00:13<00:44, 173.43it/s]
24%|██▎ | 2369/10000 [00:13<00:44, 172.52it/s]
24%|██▍ | 2387/10000 [00:13<00:44, 171.52it/s]
24%|██▍ | 2405/10000 [00:13<00:44, 172.24it/s]
24%|██▍ | 2423/10000 [00:13<00:44, 170.84it/s]
24%|██▍ | 2441/10000 [00:14<00:44, 168.81it/s]
25%|██▍ | 2458/10000 [00:14<00:45, 166.87it/s]
25%|██▍ | 2475/10000 [00:14<00:45, 166.12it/s]
25%|██▍ | 2492/10000 [00:14<00:45, 165.68it/s]
25%|██▌ | 2509/10000 [00:14<00:45, 165.38it/s]
25%|██▌ | 2526/10000 [00:14<00:45, 165.03it/s]
25%|██▌ | 2543/10000 [00:14<00:45, 165.45it/s]
26%|██▌ | 2561/10000 [00:14<00:44, 168.31it/s]
26%|██▌ | 2579/10000 [00:14<00:43, 170.37it/s]
26%|██▌ | 2597/10000 [00:15<00:43, 171.82it/s]
26%|██▌ | 2615/10000 [00:15<00:42, 172.86it/s]
26%|██▋ | 2633/10000 [00:15<00:42, 173.53it/s]
27%|██▋ | 2651/10000 [00:15<00:42, 173.94it/s]
27%|██▋ | 2669/10000 [00:15<00:42, 174.31it/s]
27%|██▋ | 2687/10000 [00:15<00:42, 173.84it/s]
27%|██▋ | 2705/10000 [00:15<00:42, 173.49it/s]
27%|██▋ | 2723/10000 [00:15<00:42, 173.23it/s]
27%|██▋ | 2741/10000 [00:15<00:42, 172.71it/s]
28%|██▊ | 2759/10000 [00:15<00:41, 172.85it/s]
28%|██▊ | 2777/10000 [00:16<00:41, 173.75it/s]
28%|██▊ | 2795/10000 [00:16<00:41, 174.37it/s]
28%|██▊ | 2813/10000 [00:16<00:41, 174.88it/s]
28%|██▊ | 2831/10000 [00:16<00:40, 175.07it/s]
28%|██▊ | 2849/10000 [00:16<00:40, 175.37it/s]
29%|██▊ | 2867/10000 [00:16<00:40, 175.53it/s]
29%|██▉ | 2885/10000 [00:16<00:40, 175.65it/s]
29%|██▉ | 2903/10000 [00:16<00:40, 175.60it/s]
29%|██▉ | 2921/10000 [00:16<00:40, 175.13it/s]
29%|██▉ | 2939/10000 [00:16<00:40, 174.17it/s]
30%|██▉ | 2957/10000 [00:17<00:40, 174.05it/s]
30%|██▉ | 2975/10000 [00:17<00:40, 174.51it/s]
30%|██▉ | 2993/10000 [00:17<00:40, 174.34it/s]
30%|███ | 3011/10000 [00:17<00:40, 174.00it/s]
30%|███ | 3029/10000 [00:17<00:40, 174.12it/s]
30%|███ | 3047/10000 [00:17<00:39, 174.15it/s]
31%|███ | 3065/10000 [00:17<00:39, 174.33it/s]
31%|███ | 3083/10000 [00:17<00:39, 174.20it/s]
31%|███ | 3101/10000 [00:17<00:39, 174.53it/s]
31%|███ | 3119/10000 [00:18<00:39, 174.91it/s]
31%|███▏ | 3137/10000 [00:18<00:39, 174.72it/s]
32%|███▏ | 3155/10000 [00:18<00:39, 175.00it/s]
32%|███▏ | 3173/10000 [00:18<00:38, 175.29it/s]
32%|███▏ | 3191/10000 [00:18<00:38, 175.46it/s]
32%|███▏ | 3209/10000 [00:18<00:38, 175.07it/s]
32%|███▏ | 3227/10000 [00:18<00:38, 175.20it/s]
32%|███▏ | 3245/10000 [00:18<00:38, 175.25it/s]
33%|███▎ | 3263/10000 [00:18<00:38, 174.94it/s]
33%|███▎ | 3281/10000 [00:18<00:38, 174.36it/s]
33%|███▎ | 3299/10000 [00:19<00:38, 173.98it/s]
33%|███▎ | 3317/10000 [00:19<00:38, 173.77it/s]
33%|███▎ | 3335/10000 [00:19<00:38, 174.10it/s]
34%|███▎ | 3353/10000 [00:19<00:38, 174.41it/s]
34%|███▎ | 3371/10000 [00:19<00:37, 174.61it/s]
34%|███▍ | 3389/10000 [00:19<00:37, 174.45it/s]
34%|███▍ | 3407/10000 [00:19<00:37, 174.57it/s]
34%|███▍ | 3425/10000 [00:19<00:37, 174.59it/s]
34%|███▍ | 3443/10000 [00:19<00:37, 174.47it/s]
35%|███▍ | 3461/10000 [00:19<00:37, 174.81it/s]
35%|███▍ | 3479/10000 [00:20<00:37, 174.56it/s]
35%|███▍ | 3497/10000 [00:20<00:37, 175.00it/s]
35%|███▌ | 3515/10000 [00:20<00:36, 175.27it/s]
35%|███▌ | 3533/10000 [00:20<00:36, 175.51it/s]
36%|███▌ | 3551/10000 [00:20<00:36, 175.76it/s]
36%|███▌ | 3569/10000 [00:20<00:36, 175.72it/s]
36%|███▌ | 3587/10000 [00:20<00:36, 175.25it/s]
36%|███▌ | 3605/10000 [00:20<00:36, 175.38it/s]
36%|███▌ | 3623/10000 [00:20<00:36, 175.38it/s]
36%|███▋ | 3641/10000 [00:21<00:36, 175.65it/s]
37%|███▋ | 3659/10000 [00:21<00:36, 175.81it/s]
37%|███▋ | 3677/10000 [00:21<00:35, 175.97it/s]
37%|███▋ | 3695/10000 [00:21<00:35, 176.05it/s]
37%|███▋ | 3713/10000 [00:21<00:35, 176.14it/s]
37%|███▋ | 3731/10000 [00:21<00:35, 176.23it/s]
37%|███▋ | 3749/10000 [00:21<00:35, 176.19it/s]
38%|███▊ | 3767/10000 [00:21<00:35, 176.24it/s]
38%|███▊ | 3785/10000 [00:21<00:35, 176.36it/s]
38%|███▊ | 3803/10000 [00:21<00:35, 176.40it/s]
38%|███▊ | 3821/10000 [00:22<00:35, 176.23it/s]
38%|███▊ | 3839/10000 [00:22<00:34, 176.29it/s]
39%|███▊ | 3857/10000 [00:22<00:34, 176.30it/s]
39%|███▉ | 3875/10000 [00:22<00:34, 175.77it/s]
39%|███▉ | 3893/10000 [00:22<00:34, 175.56it/s]
39%|███▉ | 3911/10000 [00:22<00:34, 175.41it/s]
39%|███▉ | 3929/10000 [00:22<00:34, 175.29it/s]
39%|███▉ | 3947/10000 [00:22<00:34, 175.22it/s]
40%|███▉ | 3965/10000 [00:22<00:34, 175.08it/s]
40%|███▉ | 3983/10000 [00:22<00:34, 175.02it/s]
40%|████ | 4001/10000 [00:23<00:34, 175.14it/s]
40%|████ | 4019/10000 [00:23<00:34, 175.02it/s]
40%|████ | 4037/10000 [00:23<00:34, 175.06it/s]
41%|████ | 4055/10000 [00:23<00:33, 175.10it/s]
41%|████ | 4073/10000 [00:23<00:33, 175.19it/s]
41%|████ | 4091/10000 [00:23<00:33, 175.27it/s]
41%|████ | 4109/10000 [00:23<00:33, 175.22it/s]
41%|████▏ | 4127/10000 [00:23<00:33, 175.13it/s]
41%|████▏ | 4145/10000 [00:23<00:33, 175.29it/s]
42%|████▏ | 4163/10000 [00:23<00:33, 175.60it/s]
42%|████▏ | 4181/10000 [00:24<00:33, 175.86it/s]
42%|████▏ | 4199/10000 [00:24<00:32, 176.04it/s]
42%|████▏ | 4217/10000 [00:24<00:32, 175.67it/s]
42%|████▏ | 4235/10000 [00:24<00:32, 175.38it/s]
43%|████▎ | 4253/10000 [00:24<00:33, 173.04it/s]
43%|████▎ | 4271/10000 [00:24<00:33, 170.70it/s]
43%|████▎ | 4289/10000 [00:24<00:33, 169.07it/s]
43%|████▎ | 4306/10000 [00:24<00:33, 168.26it/s]
43%|████▎ | 4324/10000 [00:24<00:33, 168.92it/s]
43%|████▎ | 4341/10000 [00:25<00:34, 165.94it/s]
44%|████▎ | 4358/10000 [00:25<00:34, 165.01it/s]
44%|████▍ | 4375/10000 [00:25<00:34, 164.11it/s]
44%|████▍ | 4392/10000 [00:25<00:34, 163.50it/s]
44%|████▍ | 4409/10000 [00:25<00:34, 163.74it/s]
44%|████▍ | 4426/10000 [00:25<00:33, 164.16it/s]
44%|████▍ | 4443/10000 [00:25<00:33, 165.18it/s]
45%|████▍ | 4460/10000 [00:25<00:33, 165.90it/s]
45%|████▍ | 4477/10000 [00:25<00:33, 166.49it/s]
45%|████▍ | 4494/10000 [00:25<00:32, 167.23it/s]
45%|████▌ | 4511/10000 [00:26<00:32, 167.16it/s]
45%|████▌ | 4528/10000 [00:26<00:32, 166.45it/s]
45%|████▌ | 4545/10000 [00:26<00:33, 164.91it/s]
46%|████▌ | 4562/10000 [00:26<00:32, 165.75it/s]
46%|████▌ | 4579/10000 [00:26<00:32, 166.81it/s]
46%|████▌ | 4596/10000 [00:26<00:32, 167.57it/s]
46%|████▌ | 4613/10000 [00:26<00:32, 168.08it/s]
46%|████▋ | 4630/10000 [00:26<00:31, 168.16it/s]
46%|████▋ | 4647/10000 [00:26<00:31, 167.35it/s]
47%|████▋ | 4664/10000 [00:26<00:32, 166.66it/s]
47%|████▋ | 4681/10000 [00:27<00:31, 166.44it/s]
47%|████▋ | 4698/10000 [00:27<00:31, 166.01it/s]
47%|████▋ | 4715/10000 [00:27<00:31, 165.69it/s]
47%|████▋ | 4732/10000 [00:27<00:31, 166.71it/s]
48%|████▊ | 4750/10000 [00:27<00:31, 167.77it/s]
48%|████▊ | 4767/10000 [00:27<00:31, 168.10it/s]
48%|████▊ | 4784/10000 [00:27<00:31, 165.50it/s]
48%|████▊ | 4801/10000 [00:27<00:31, 163.45it/s]
48%|████▊ | 4818/10000 [00:27<00:31, 164.84it/s]
48%|████▊ | 4835/10000 [00:28<00:31, 166.22it/s]
49%|████▊ | 4852/10000 [00:28<00:30, 166.72it/s]
49%|████▊ | 4869/10000 [00:28<00:30, 166.44it/s]
49%|████▉ | 4886/10000 [00:28<00:30, 166.28it/s]
49%|████▉ | 4903/10000 [00:28<00:30, 165.30it/s]
49%|████▉ | 4920/10000 [00:28<00:30, 165.06it/s]
49%|████▉ | 4937/10000 [00:28<00:30, 164.11it/s]
50%|████▉ | 4954/10000 [00:28<00:30, 164.43it/s]
50%|████▉ | 4971/10000 [00:28<00:30, 165.00it/s]
50%|████▉ | 4988/10000 [00:28<00:30, 165.22it/s]
50%|█████ | 5005/10000 [00:29<00:30, 166.20it/s]
50%|█████ | 5022/10000 [00:29<00:29, 166.55it/s]
50%|█████ | 5039/10000 [00:29<00:29, 165.96it/s]
51%|█████ | 5056/10000 [00:29<00:29, 165.69it/s]
51%|█████ | 5073/10000 [00:29<00:29, 165.52it/s]
51%|█████ | 5090/10000 [00:29<00:29, 166.13it/s]
51%|█████ | 5107/10000 [00:29<00:29, 165.93it/s]
51%|█████ | 5124/10000 [00:29<00:29, 166.06it/s]
51%|█████▏ | 5141/10000 [00:29<00:29, 166.51it/s]
52%|█████▏ | 5158/10000 [00:29<00:29, 165.53it/s]
52%|█████▏ | 5175/10000 [00:30<00:29, 165.69it/s]
52%|█████▏ | 5192/10000 [00:30<00:29, 164.91it/s]
52%|█████▏ | 5209/10000 [00:30<00:29, 164.12it/s]
52%|█████▏ | 5226/10000 [00:30<00:29, 163.76it/s]
52%|█████▏ | 5243/10000 [00:30<00:28, 164.12it/s]
53%|█████▎ | 5260/10000 [00:30<00:28, 164.44it/s]
53%|█████▎ | 5277/10000 [00:30<00:28, 164.66it/s]
53%|█████▎ | 5294/10000 [00:30<00:28, 164.73it/s]
53%|█████▎ | 5311/10000 [00:30<00:28, 164.91it/s]
53%|█████▎ | 5328/10000 [00:30<00:28, 164.96it/s]
53%|█████▎ | 5345/10000 [00:31<00:28, 165.04it/s]
54%|█████▎ | 5362/10000 [00:31<00:28, 165.14it/s]
54%|█████▍ | 5379/10000 [00:31<00:28, 165.03it/s]
54%|█████▍ | 5396/10000 [00:31<00:27, 164.97it/s]
54%|█████▍ | 5413/10000 [00:31<00:27, 165.09it/s]
54%|█████▍ | 5430/10000 [00:31<00:27, 165.22it/s]
54%|█████▍ | 5447/10000 [00:31<00:27, 165.20it/s]
55%|█████▍ | 5464/10000 [00:31<00:27, 164.86it/s]
55%|█████▍ | 5481/10000 [00:31<00:27, 165.01it/s]
55%|█████▍ | 5498/10000 [00:32<00:27, 165.23it/s]
55%|█████▌ | 5515/10000 [00:32<00:27, 165.39it/s]
55%|█████▌ | 5532/10000 [00:32<00:26, 165.57it/s]
55%|█████▌ | 5549/10000 [00:32<00:26, 165.68it/s]
56%|█████▌ | 5566/10000 [00:32<00:26, 165.71it/s]
56%|█████▌ | 5583/10000 [00:32<00:26, 165.80it/s]
56%|█████▌ | 5600/10000 [00:32<00:26, 165.85it/s]
56%|█████▌ | 5617/10000 [00:32<00:26, 165.91it/s]
56%|█████▋ | 5634/10000 [00:32<00:26, 165.69it/s]
57%|█████▋ | 5651/10000 [00:32<00:26, 165.56it/s]
57%|█████▋ | 5668/10000 [00:33<00:26, 165.52it/s]
57%|█████▋ | 5685/10000 [00:33<00:26, 165.54it/s]
57%|█████▋ | 5702/10000 [00:33<00:25, 165.46it/s]
57%|█████▋ | 5719/10000 [00:33<00:25, 165.39it/s]
57%|█████▋ | 5736/10000 [00:33<00:25, 165.33it/s]
58%|█████▊ | 5753/10000 [00:33<00:25, 165.38it/s]
58%|█████▊ | 5770/10000 [00:33<00:25, 165.38it/s]
58%|█████▊ | 5787/10000 [00:33<00:25, 165.29it/s]
58%|█████▊ | 5804/10000 [00:33<00:25, 164.94it/s]
58%|█████▊ | 5821/10000 [00:33<00:25, 164.03it/s]
58%|█████▊ | 5838/10000 [00:34<00:25, 164.30it/s]
59%|█████▊ | 5855/10000 [00:34<00:25, 164.70it/s]
59%|█████▊ | 5872/10000 [00:34<00:25, 164.97it/s]
59%|█████▉ | 5889/10000 [00:34<00:24, 165.20it/s]
59%|█████▉ | 5906/10000 [00:34<00:24, 165.38it/s]
59%|█████▉ | 5923/10000 [00:34<00:24, 165.50it/s]
59%|█████▉ | 5940/10000 [00:34<00:24, 165.62it/s]
60%|█████▉ | 5957/10000 [00:34<00:24, 165.37it/s]
60%|█████▉ | 5974/10000 [00:34<00:24, 165.05it/s]
60%|█████▉ | 5991/10000 [00:35<00:24, 164.93it/s]
60%|██████ | 6008/10000 [00:35<00:24, 164.92it/s]
60%|██████ | 6025/10000 [00:35<00:24, 162.04it/s]
60%|██████ | 6042/10000 [00:35<00:24, 159.01it/s]
61%|██████ | 6059/10000 [00:35<00:24, 160.78it/s]
61%|██████ | 6076/10000 [00:35<00:24, 162.21it/s]
61%|██████ | 6093/10000 [00:35<00:23, 163.23it/s]
61%|██████ | 6110/10000 [00:35<00:23, 164.08it/s]
61%|██████▏ | 6127/10000 [00:35<00:23, 164.71it/s]
61%|██████▏ | 6144/10000 [00:35<00:23, 165.12it/s]
62%|██████▏ | 6161/10000 [00:36<00:23, 164.63it/s]
62%|██████▏ | 6178/10000 [00:36<00:23, 164.66it/s]
62%|██████▏ | 6195/10000 [00:36<00:23, 164.78it/s]
62%|██████▏ | 6212/10000 [00:36<00:22, 164.88it/s]
62%|██████▏ | 6229/10000 [00:36<00:23, 163.31it/s]
62%|██████▏ | 6246/10000 [00:36<00:22, 163.88it/s]
63%|██████▎ | 6263/10000 [00:36<00:22, 164.34it/s]
63%|██████▎ | 6280/10000 [00:36<00:22, 164.76it/s]
63%|██████▎ | 6297/10000 [00:36<00:22, 164.56it/s]
63%|██████▎ | 6314/10000 [00:36<00:22, 164.74it/s]
63%|██████▎ | 6331/10000 [00:37<00:22, 164.85it/s]
63%|██████▎ | 6348/10000 [00:37<00:22, 164.93it/s]
64%|██████▎ | 6365/10000 [00:37<00:22, 165.05it/s]
64%|██████▍ | 6382/10000 [00:37<00:22, 163.29it/s]
64%|██████▍ | 6399/10000 [00:37<00:22, 160.54it/s]
64%|██████▍ | 6416/10000 [00:37<00:22, 158.66it/s]
64%|██████▍ | 6432/10000 [00:37<00:22, 157.45it/s]
64%|██████▍ | 6448/10000 [00:37<00:22, 156.29it/s]
65%|██████▍ | 6464/10000 [00:37<00:22, 155.96it/s]
65%|██████▍ | 6480/10000 [00:38<00:22, 155.59it/s]
65%|██████▍ | 6496/10000 [00:38<00:22, 155.40it/s]
65%|██████▌ | 6512/10000 [00:38<00:22, 154.54it/s]
65%|██████▌ | 6528/10000 [00:38<00:22, 153.96it/s]
65%|██████▌ | 6544/10000 [00:38<00:22, 153.81it/s]
66%|██████▌ | 6560/10000 [00:38<00:22, 154.25it/s]
66%|██████▌ | 6576/10000 [00:38<00:22, 154.49it/s]
66%|██████▌ | 6592/10000 [00:38<00:22, 154.72it/s]
66%|██████▌ | 6608/10000 [00:38<00:21, 154.29it/s]
66%|██████▌ | 6624/10000 [00:38<00:21, 154.43it/s]
66%|██████▋ | 6640/10000 [00:39<00:21, 154.70it/s]
67%|██████▋ | 6656/10000 [00:39<00:21, 154.86it/s]
67%|██████▋ | 6672/10000 [00:39<00:21, 155.04it/s]
67%|██████▋ | 6688/10000 [00:39<00:21, 155.07it/s]
67%|██████▋ | 6704/10000 [00:39<00:21, 155.11it/s]
67%|██████▋ | 6720/10000 [00:39<00:21, 155.14it/s]
67%|██████▋ | 6736/10000 [00:39<00:21, 155.18it/s]
68%|██████▊ | 6752/10000 [00:39<00:20, 155.20it/s]
68%|██████▊ | 6768/10000 [00:39<00:20, 155.26it/s]
68%|██████▊ | 6784/10000 [00:39<00:20, 155.36it/s]
68%|██████▊ | 6800/10000 [00:40<00:20, 154.84it/s]
68%|██████▊ | 6816/10000 [00:40<00:20, 155.75it/s]
68%|██████▊ | 6832/10000 [00:40<00:20, 156.43it/s]
68%|██████▊ | 6848/10000 [00:40<00:20, 156.42it/s]
69%|██████▊ | 6865/10000 [00:40<00:19, 159.12it/s]
69%|██████▉ | 6882/10000 [00:40<00:19, 160.50it/s]
69%|██████▉ | 6899/10000 [00:40<00:19, 159.78it/s]
69%|██████▉ | 6915/10000 [00:40<00:19, 159.48it/s]
69%|██████▉ | 6931/10000 [00:40<00:19, 159.00it/s]
69%|██████▉ | 6947/10000 [00:41<00:19, 158.91it/s]
70%|██████▉ | 6964/10000 [00:41<00:19, 159.76it/s]
70%|██████▉ | 6980/10000 [00:41<00:18, 159.13it/s]
70%|██████▉ | 6996/10000 [00:41<00:19, 156.27it/s]
70%|███████ | 7012/10000 [00:41<00:19, 155.25it/s]
70%|███████ | 7028/10000 [00:41<00:19, 155.14it/s]
70%|███████ | 7044/10000 [00:41<00:19, 153.87it/s]
71%|███████ | 7060/10000 [00:41<00:19, 154.15it/s]
71%|███████ | 7076/10000 [00:41<00:18, 153.91it/s]
71%|███████ | 7092/10000 [00:41<00:18, 154.04it/s]
71%|███████ | 7108/10000 [00:42<00:18, 152.83it/s]
71%|███████ | 7124/10000 [00:42<00:18, 153.22it/s]
71%|███████▏ | 7140/10000 [00:42<00:18, 153.65it/s]
72%|███████▏ | 7156/10000 [00:42<00:18, 154.00it/s]
72%|███████▏ | 7172/10000 [00:42<00:18, 154.21it/s]
72%|███████▏ | 7188/10000 [00:42<00:18, 154.41it/s]
72%|███████▏ | 7204/10000 [00:42<00:18, 154.52it/s]
72%|███████▏ | 7220/10000 [00:42<00:18, 154.39it/s]
72%|███████▏ | 7236/10000 [00:42<00:17, 154.20it/s]
73%|███████▎ | 7252/10000 [00:42<00:17, 154.38it/s]
73%|███████▎ | 7268/10000 [00:43<00:17, 154.59it/s]
73%|███████▎ | 7284/10000 [00:43<00:17, 153.91it/s]
73%|███████▎ | 7300/10000 [00:43<00:17, 152.92it/s]
73%|███████▎ | 7316/10000 [00:43<00:17, 150.66it/s]
73%|███████▎ | 7332/10000 [00:43<00:17, 151.75it/s]
73%|███████▎ | 7348/10000 [00:43<00:17, 152.61it/s]
74%|███████▎ | 7364/10000 [00:43<00:17, 153.25it/s]
74%|███████▍ | 7380/10000 [00:43<00:17, 153.69it/s]
74%|███████▍ | 7396/10000 [00:43<00:16, 153.22it/s]
74%|███████▍ | 7412/10000 [00:44<00:17, 149.32it/s]
74%|███████▍ | 7428/10000 [00:44<00:17, 149.67it/s]
74%|███████▍ | 7444/10000 [00:44<00:17, 150.13it/s]
75%|███████▍ | 7460/10000 [00:44<00:16, 150.92it/s]
75%|███████▍ | 7476/10000 [00:44<00:16, 151.81it/s]
75%|███████▍ | 7492/10000 [00:44<00:16, 152.54it/s]
75%|███████▌ | 7508/10000 [00:44<00:16, 153.13it/s]
75%|███████▌ | 7524/10000 [00:44<00:16, 153.61it/s]
75%|███████▌ | 7540/10000 [00:44<00:16, 153.46it/s]
76%|███████▌ | 7556/10000 [00:44<00:15, 153.84it/s]
76%|███████▌ | 7572/10000 [00:45<00:15, 154.24it/s]
76%|███████▌ | 7588/10000 [00:45<00:15, 154.54it/s]
76%|███████▌ | 7604/10000 [00:45<00:15, 154.64it/s]
76%|███████▌ | 7620/10000 [00:45<00:15, 154.72it/s]
76%|███████▋ | 7636/10000 [00:45<00:15, 154.75it/s]
77%|███████▋ | 7652/10000 [00:45<00:15, 153.22it/s]
77%|███████▋ | 7668/10000 [00:45<00:15, 153.66it/s]
77%|███████▋ | 7684/10000 [00:45<00:15, 154.05it/s]
77%|███████▋ | 7700/10000 [00:45<00:14, 153.64it/s]
77%|███████▋ | 7716/10000 [00:46<00:14, 154.03it/s]
77%|███████▋ | 7732/10000 [00:46<00:14, 154.36it/s]
77%|███████▋ | 7748/10000 [00:46<00:14, 154.63it/s]
78%|███████▊ | 7764/10000 [00:46<00:14, 154.18it/s]
78%|███████▊ | 7780/10000 [00:46<00:14, 153.97it/s]
78%|███████▊ | 7796/10000 [00:46<00:14, 153.95it/s]
78%|███████▊ | 7812/10000 [00:46<00:14, 153.83it/s]
78%|███████▊ | 7828/10000 [00:46<00:14, 153.75it/s]
78%|███████▊ | 7844/10000 [00:46<00:14, 152.96it/s]
79%|███████▊ | 7860/10000 [00:46<00:13, 153.07it/s]
79%|███████▉ | 7876/10000 [00:47<00:13, 152.83it/s]
79%|███████▉ | 7892/10000 [00:47<00:13, 152.64it/s]
79%|███████▉ | 7908/10000 [00:47<00:13, 152.55it/s]
79%|███████▉ | 7924/10000 [00:47<00:13, 152.95it/s]
79%|███████▉ | 7940/10000 [00:47<00:13, 153.38it/s]
80%|███████▉ | 7956/10000 [00:47<00:13, 153.68it/s]
80%|███████▉ | 7972/10000 [00:47<00:13, 153.83it/s]
80%|███████▉ | 7988/10000 [00:47<00:13, 153.46it/s]
80%|████████ | 8004/10000 [00:47<00:13, 152.82it/s]
80%|████████ | 8020/10000 [00:48<00:12, 152.85it/s]
80%|████████ | 8036/10000 [00:48<00:12, 153.01it/s]
81%|████████ | 8052/10000 [00:48<00:12, 153.11it/s]
81%|████████ | 8068/10000 [00:48<00:12, 153.22it/s]
81%|████████ | 8084/10000 [00:48<00:12, 153.36it/s]
81%|████████ | 8100/10000 [00:48<00:12, 153.37it/s]
81%|████████ | 8116/10000 [00:48<00:12, 153.37it/s]
81%|████████▏ | 8132/10000 [00:48<00:12, 153.18it/s]
81%|████████▏ | 8148/10000 [00:48<00:12, 153.28it/s]
82%|████████▏ | 8164/10000 [00:48<00:12, 152.45it/s]
82%|████████▏ | 8180/10000 [00:49<00:11, 152.92it/s]
82%|████████▏ | 8196/10000 [00:49<00:11, 153.14it/s]
82%|████████▏ | 8212/10000 [00:49<00:11, 153.69it/s]
82%|████████▏ | 8229/10000 [00:49<00:11, 156.18it/s]
82%|████████▏ | 8245/10000 [00:49<00:11, 157.15it/s]
83%|████████▎ | 8261/10000 [00:49<00:11, 157.31it/s]
83%|████████▎ | 8277/10000 [00:49<00:10, 157.00it/s]
83%|████████▎ | 8294/10000 [00:49<00:10, 158.14it/s]
83%|████████▎ | 8310/10000 [00:49<00:10, 157.63it/s]
83%|████████▎ | 8326/10000 [00:49<00:10, 157.32it/s]
83%|████████▎ | 8342/10000 [00:50<00:10, 156.07it/s]
84%|████████▎ | 8358/10000 [00:50<00:10, 154.90it/s]
84%|████████▎ | 8374/10000 [00:50<00:10, 154.81it/s]
84%|████████▍ | 8390/10000 [00:50<00:10, 154.82it/s]
84%|████████▍ | 8406/10000 [00:50<00:10, 155.30it/s]
84%|████████▍ | 8422/10000 [00:50<00:10, 156.08it/s]
84%|████████▍ | 8438/10000 [00:50<00:09, 156.64it/s]
85%|████████▍ | 8454/10000 [00:50<00:09, 156.83it/s]
85%|████████▍ | 8470/10000 [00:50<00:09, 156.24it/s]
85%|████████▍ | 8486/10000 [00:51<00:09, 155.85it/s]
85%|████████▌ | 8502/10000 [00:51<00:09, 155.58it/s]
85%|████████▌ | 8518/10000 [00:51<00:09, 155.55it/s]
85%|████████▌ | 8534/10000 [00:51<00:09, 155.47it/s]
86%|████████▌ | 8550/10000 [00:51<00:09, 155.47it/s]
86%|████████▌ | 8566/10000 [00:51<00:09, 155.18it/s]
86%|████████▌ | 8582/10000 [00:51<00:09, 155.19it/s]
86%|████████▌ | 8598/10000 [00:51<00:08, 156.34it/s]
86%|████████▌ | 8614/10000 [00:51<00:08, 155.55it/s]
86%|████████▋ | 8630/10000 [00:51<00:08, 156.24it/s]
86%|████████▋ | 8646/10000 [00:52<00:08, 156.49it/s]
87%|████████▋ | 8662/10000 [00:52<00:08, 156.58it/s]
87%|████████▋ | 8678/10000 [00:52<00:08, 155.91it/s]
87%|████████▋ | 8694/10000 [00:52<00:08, 155.93it/s]
87%|████████▋ | 8710/10000 [00:52<00:08, 156.37it/s]
87%|████████▋ | 8726/10000 [00:52<00:08, 156.57it/s]
87%|████████▋ | 8742/10000 [00:52<00:08, 154.56it/s]
88%|████████▊ | 8758/10000 [00:52<00:08, 153.24it/s]
88%|████████▊ | 8774/10000 [00:52<00:08, 152.85it/s]
88%|████████▊ | 8790/10000 [00:52<00:07, 152.74it/s]
88%|████████▊ | 8806/10000 [00:53<00:07, 153.28it/s]
88%|████████▊ | 8822/10000 [00:53<00:07, 153.68it/s]
88%|████████▊ | 8838/10000 [00:53<00:07, 154.13it/s]
89%|████████▊ | 8854/10000 [00:53<00:07, 154.45it/s]
89%|████████▊ | 8870/10000 [00:53<00:07, 154.66it/s]
89%|████████▉ | 8886/10000 [00:53<00:07, 154.85it/s]
89%|████████▉ | 8902/10000 [00:53<00:07, 154.69it/s]
89%|████████▉ | 8918/10000 [00:53<00:07, 154.31it/s]
89%|████████▉ | 8934/10000 [00:53<00:06, 154.52it/s]
90%|████████▉ | 8950/10000 [00:54<00:06, 154.26it/s]
90%|████████▉ | 8966/10000 [00:54<00:06, 154.52it/s]
90%|████████▉ | 8982/10000 [00:54<00:06, 154.70it/s]
90%|████████▉ | 8998/10000 [00:54<00:06, 154.41it/s]
90%|█████████ | 9014/10000 [00:54<00:06, 154.15it/s]
90%|█████████ | 9030/10000 [00:54<00:06, 154.16it/s]
90%|█████████ | 9046/10000 [00:54<00:06, 154.06it/s]
91%|█████████ | 9062/10000 [00:54<00:06, 154.04it/s]
91%|█████████ | 9078/10000 [00:54<00:05, 154.22it/s]
91%|█████████ | 9094/10000 [00:54<00:05, 154.25it/s]
91%|█████████ | 9110/10000 [00:55<00:05, 154.32it/s]
91%|█████████▏| 9126/10000 [00:55<00:05, 154.32it/s]
91%|█████████▏| 9142/10000 [00:55<00:05, 154.40it/s]
92%|█████████▏| 9158/10000 [00:55<00:05, 153.91it/s]
92%|█████████▏| 9174/10000 [00:55<00:05, 154.18it/s]
92%|█████████▏| 9190/10000 [00:55<00:05, 154.42it/s]
92%|█████████▏| 9206/10000 [00:55<00:05, 154.58it/s]
92%|█████████▏| 9222/10000 [00:55<00:05, 154.67it/s]
92%|█████████▏| 9238/10000 [00:55<00:04, 154.54it/s]
93%|█████████▎| 9254/10000 [00:55<00:04, 154.61it/s]
93%|█████████▎| 9270/10000 [00:56<00:04, 153.04it/s]
93%|█████████▎| 9286/10000 [00:56<00:04, 149.84it/s]
93%|█████████▎| 9302/10000 [00:56<00:04, 146.50it/s]
93%|█████████▎| 9317/10000 [00:56<00:04, 145.39it/s]
93%|█████████▎| 9332/10000 [00:56<00:04, 144.51it/s]
93%|█████████▎| 9347/10000 [00:56<00:04, 143.93it/s]
94%|█████████▎| 9362/10000 [00:56<00:04, 143.64it/s]
94%|█████████▍| 9377/10000 [00:56<00:04, 143.06it/s]
94%|█████████▍| 9392/10000 [00:56<00:04, 142.89it/s]
94%|█████████▍| 9407/10000 [00:57<00:04, 142.84it/s]
94%|█████████▍| 9422/10000 [00:57<00:04, 142.84it/s]
94%|█████████▍| 9437/10000 [00:57<00:03, 142.83it/s]
95%|█████████▍| 9452/10000 [00:57<00:03, 142.81it/s]
95%|█████████▍| 9467/10000 [00:57<00:03, 142.68it/s]
95%|█████████▍| 9482/10000 [00:57<00:03, 142.76it/s]
95%|█████████▍| 9497/10000 [00:57<00:03, 142.82it/s]
95%|█████████▌| 9512/10000 [00:57<00:03, 142.78it/s]
95%|█████████▌| 9527/10000 [00:57<00:03, 142.86it/s]
95%|█████████▌| 9542/10000 [00:57<00:03, 142.85it/s]
96%|█████████▌| 9557/10000 [00:58<00:03, 142.92it/s]
96%|█████████▌| 9572/10000 [00:58<00:02, 142.98it/s]
96%|█████████▌| 9587/10000 [00:58<00:02, 142.93it/s]
96%|█████████▌| 9602/10000 [00:58<00:02, 142.88it/s]
96%|█████████▌| 9617/10000 [00:58<00:02, 142.86it/s]
96%|█████████▋| 9632/10000 [00:58<00:02, 142.94it/s]
96%|█████████▋| 9647/10000 [00:58<00:02, 142.90it/s]
97%|█████████▋| 9662/10000 [00:58<00:02, 142.42it/s]
97%|█████████▋| 9677/10000 [00:58<00:02, 142.24it/s]
97%|█████████▋| 9692/10000 [00:59<00:02, 142.12it/s]
97%|█████████▋| 9707/10000 [00:59<00:02, 142.19it/s]
97%|█████████▋| 9722/10000 [00:59<00:01, 142.44it/s]
97%|█████████▋| 9738/10000 [00:59<00:01, 146.05it/s]
98%|█████████▊| 9753/10000 [00:59<00:01, 146.15it/s]
98%|█████████▊| 9768/10000 [00:59<00:01, 147.10it/s]
98%|█████████▊| 9783/10000 [00:59<00:01, 147.86it/s]
98%|█████████▊| 9799/10000 [00:59<00:01, 149.86it/s]
98%|█████████▊| 9814/10000 [00:59<00:01, 148.14it/s]
98%|█████████▊| 9830/10000 [00:59<00:01, 149.15it/s]
98%|█████████▊| 9846/10000 [01:00<00:01, 149.74it/s]
99%|█████████▊| 9862/10000 [01:00<00:00, 150.55it/s]
99%|█████████▉| 9878/10000 [01:00<00:00, 149.53it/s]
99%|█████████▉| 9894/10000 [01:00<00:00, 149.87it/s]
99%|█████████▉| 9910/10000 [01:00<00:00, 150.14it/s]
99%|█████████▉| 9926/10000 [01:00<00:00, 148.82it/s]
99%|█████████▉| 9941/10000 [01:00<00:00, 146.93it/s]
100%|█████████▉| 9956/10000 [01:00<00:00, 147.54it/s]
100%|█████████▉| 9972/10000 [01:00<00:00, 148.90it/s]
100%|█████████▉| 9987/10000 [01:01<00:00, 148.86it/s]
100%|██████████| 10000/10000 [01:02<00:00, 158.93it/s]
Define new variables
Defining new variables...: 0%| | 0/10 [00:00<?, ?it/s]
Defining new variables...: 10%|█ | 1/10 [00:00<00:01, 8.49it/s]
Defining new variables...: 20%|██ | 2/10 [00:00<00:00, 8.79it/s]
Defining new variables...: 30%|███ | 3/10 [00:00<00:00, 8.95it/s]
Defining new variables...: 40%|████ | 4/10 [00:00<00:00, 9.05it/s]
Defining new variables...: 50%|█████ | 5/10 [00:00<00:00, 9.04it/s]
Defining new variables...: 60%|██████ | 6/10 [00:00<00:00, 8.82it/s]
Defining new variables...: 70%|███████ | 7/10 [00:00<00:00, 8.62it/s]
Defining new variables...: 80%|████████ | 8/10 [00:00<00:00, 8.55it/s]
Defining new variables...: 90%|█████████ | 9/10 [00:01<00:00, 8.47it/s]
Defining new variables...: 100%|██████████| 10/10 [00:01<00:00, 8.44it/s]
Defining new variables...: 100%|██████████| 10/10 [00:10<00:00, 1.08s/it]
File cnl_10_63.dat has been created.
logprob = the_model_generation.get_cross_nested_logit()
the_biogeme = BIOGEME(biogeme_database, logprob)
the_biogeme.model_name = MODEL_NAME
Biogeme parameters read from biogeme.toml.
Calculate the null log likelihood for reporting.
the_biogeme.calculate_null_loglikelihood(
{i: 1 for i in range(context.total_sample_size)}
)
-23025.850929940458
Estimate the parameters.
results = the_biogeme.estimate(recycle=False)
*** Initial values of the parameters are obtained from the file __cnl_10_63.iter
Parameter values restored from __cnl_10_63.iter
Starting values for the algorithm: {'beta_rating': 0.7365266291094059, 'beta_price': -0.4239680674266754, 'beta_chinese': 0.738785241646357, 'beta_japanese': 1.2813341992881495, 'beta_korean': 0.7871329380842219, 'beta_indian': 1.078119718024791, 'beta_french': 0.7632288866575481, 'beta_mexican': 1.2593243502328455, 'beta_lebanese': 0.7497810818603908, 'beta_ethiopian': 0.5555323545985966, 'beta_log_dist': -0.5854142682626837, 'mu_downtown': 1.9338601890193694, 'mu_asian': 2.112962768508359}
As the model is not too complex, we activate the calculation of second derivatives. To change this behavior, modify the algorithm to "simple_bounds" in the TOML file.
Optimization algorithm: hybrid Newton/BFGS with simple bounds [simple_bounds]
** Optimization: Newton with trust region for simple bounds
Optimization algorithm has converged.
Relative gradient: 2.933940829781729e-07
Cause of termination: Relative gradient = 2.9e-07 <= 6.1e-06
Number of function evaluations: 1
Number of gradient evaluations: 1
Number of hessian evaluations: 0
Algorithm: Newton with trust region for simple bound constraints
Number of iterations: 0
Optimization time: 0:05:06.445139
Calculate second derivatives and BHHH
File cnl_10_63~00.html has been generated.
File cnl_10_63~00.yaml has been generated.
print(results.short_summary())
Results for model cnl_10_63
Nbr of parameters: 13
Sample size: 10000
Excluded data: 0
Null log likelihood: -23025.85
Final log likelihood: -14014.06
Likelihood ratio test (null): 18023.57
Rho square (null): 0.391
Rho bar square (null): 0.391
Akaike Information Criterion: 28054.13
Bayesian Information Criterion: 28147.86
estimated_parameters = get_pandas_estimated_parameters(estimation_results=results)
display(estimated_parameters)
Name Value Robust std err. Robust t-stat. Robust p-value
0 beta_rating 0.736527 0.014947 49.277321 0.0
1 beta_price -0.423968 0.012658 -33.493402 0.0
2 beta_chinese 0.738785 0.062006 11.914783 0.0
3 beta_japanese 1.281334 0.046413 27.607232 0.0
4 beta_korean 0.787133 0.053694 14.659536 0.0
5 beta_indian 1.078120 0.053553 20.131981 0.0
6 beta_french 0.763229 0.049590 15.390741 0.0
7 beta_mexican 1.259324 0.030265 41.609970 0.0
8 beta_lebanese 0.749781 0.049632 15.106678 0.0
9 beta_ethiopian 0.555532 0.041136 13.504778 0.0
10 beta_log_dist -0.585414 0.012764 -45.864380 0.0
11 mu_downtown 1.933860 0.030348 63.722869 0.0
12 mu_asian 2.112963 0.068147 31.006151 0.0
df, msg = compare(estimated_parameters)
print(df)
Name True Value Estimated Value T-Test
0 beta_rating 0.75 0.736527 0.901436
1 beta_price -0.40 -0.423968 1.893473
2 beta_chinese 0.75 0.738785 0.180866
3 beta_japanese 1.25 1.281334 -0.675117
4 beta_korean 0.75 0.787133 -0.691563
5 beta_indian 1.00 1.078120 -1.458748
6 beta_french 0.75 0.763229 -0.266764
7 beta_mexican 1.25 1.259324 -0.308091
8 beta_lebanese 0.75 0.749781 0.004411
9 beta_ethiopian 0.50 0.555532 -1.349970
10 beta_log_dist -0.60 -0.585414 -1.142722
11 mu_asian 2.00 2.112963 -1.657644
12 mu_downtown 2.00 1.933860 2.179381
print(msg)
Total running time of the script: (52 minutes 29.717 seconds)