biogeme.segmentation.database module¶
- biogeme.segmentation.database.generate_segmentation(dataframe, variable, mapping=None, reference=None)[source]¶
Generate a segmentation tuple for a variable.
- Parameters:
dataframe (
DataFrame) – data frame.variable (
Variable|str) – Variable object or name of the variablemapping (
dict[int,str] |None) – mapping associating values of the variable to names. If incomplete, default names are provided.reference (
str|None) – name of the reference category. If None, an arbitrary category is selected as reference.
- Return type:
- biogeme.segmentation.database.logger = <Logger biogeme.segmentation.database (DEBUG)>¶
Logger that controls the output of messages to the screen and log file.
- biogeme.segmentation.database.verify_segmentation(dataframe, segmentation)[source]¶
Verifies if the definition of the segmentation is consistent with the data
- Parameters:
dataframe (
DataFrame) – dataframe to check.segmentation (
DiscreteSegmentationTuple) – definition of the segmentation
- Raises:
BiogemeError – if the segmentation is not consistent with the data.
- Return type:
None