biogeme.sampling_of_alternatives.choice_set_generation module

Module in charge of functionalities related to the choice set generation

For thew main sample, all alternatives except the last one must be used: 0 to J-1. For MEV models, the approximation of the sum capturing the nests requires another sample not based on the choice.

author:

Michel Bierlaire

date:

Fri Oct 27 12:50:06 2023

class biogeme.sampling_of_alternatives.choice_set_generation.ChoiceSetsGeneration(context)[source]

Bases: object

Class in charge of generationg the choice sets for each individual.

Parameters:

context (SamplingContext)

define_new_variables(database)[source]

Create the new variables

Parameters:

database (Database) – database, in Biogeme format.

get_attributes_from_expression(expression)[source]

Extract the names of the attributes of alternatives from an expression

Return type:

set[str]

Parameters:

expression (Expression)

process_row(individual_row)[source]

Process one row of the individual database

Parameters:

individual_row (Series) – row corresponding to one individual

Return type:

dict

Returns:

a dictionary containing the data for the extended row

sample_and_merge(recycle=False)[source]

Loops on the individuals and generate a choice set for each of them

Parameters:

recycle (bool) – if True, if the data file already exisits, it is not re-created.

Return type:

Database

Returns:

database for Biogeme