ID manager
Management of the IDs of mathematical expressions
biogeme.idmanager module
Combine several arithmetic expressions and a database to obtain formulas
- author:
Michel Bierlaire
- date:
Sat Jul 30 12:36:40 2022
- class biogeme.idmanager.ElementsTuple(expressions, indices, names)[source]
Bases:
NamedTuple
- expressions: Dict[str, Expression]
Alias for field number 0
- indices: Dict[str, int]
Alias for field number 1
- names: List[str]
Alias for field number 2
- class biogeme.idmanager.IdManager(expressions, database, number_of_draws)[source]
Bases:
object
Class combining managing the ids of an arithmetic expression.
- __init__(expressions, database, number_of_draws)[source]
Ctor
- Parameters:
expressions (list(biogeme.expressions.Expression)) – list of expressions
database (biogeme.database.Database) – database with the variables as column names
number_of_draws (int) – number of draws for Monte-Carlo integration
- Raises:
BiogemeError – if an expression contains a variable and no database is provided.
- audit()[source]
Performs various checks on the expressions.
- Returns:
tuple listOfErrors, listOfWarnings
- Return type:
list(string), list(string)
- change_init_values(betas)[source]
Modifies the values of the pameters
- Parameters:
betas (dict(string:float)) – dictionary where the keys are the names of the parameters, and the values are the new value for the parameters.
- expressions_names_indices(dict_of_elements)[source]
Assigns consecutive indices to expressions
- Parameters:
dict_of_elements (dict(str: biogeme.expressions.Expression)) – dictionary of expressions. The keys are the names.
- Returns:
a tuple with the original dictionary, the indices, and the sorted names.
- Return type:
- prepare()[source]
Extract from the formulas the literals (parameters, variables, random variables) and decide a numbering convention.
The numbering is done in the following order:
free betas,
fixed betas,
random variables for numerical integration,
random variables for Monte-Carlo integration,
variables
The numbering convention will be performed for all expressions together, so that the same elementary expressions in several expressions will have the same index.
- setData(sample)[source]
Specify the sample
- Parameters:
sample (pandas.DataFrame) – map of the panel data (see
biogeme.database.Database.buildPanelMap()
)
- setDataMap(sample)[source]
Specify the map of the panel data in the expressions
- Parameters:
sample (pandas.DataFrame) – map of the panel data (see
biogeme.database.Database.buildPanelMap()
)