Note
Go to the end to download the full example code.
Analysing Population Synthesis#
In this example we show how to examine the performance of the Population Synthesizer.
sphinx_gallery_thumbnail_path = ‘../../examples/result_analysis/pop_synth.png’
from pathlib import Path
from polaris.analyze.popsyn_analysis import PopsynComparator
from polaris.utils.logging_utils import stdout_logging # noqa: E402
stdout_logging()
project_dir = Path("/tmp/Bloomington")
iteration_folder = project_dir / "Bloomington_iteration_4"
sample_factor = 0.25
comp = PopsynComparator(iteration_folder, sample_factor)
comp.summarise()
2024-11-12T18:54:29+0000 Synthesized 99.94% of households - synthesized = 58,924, sf1 marginal = 58,958
2024-11-12T18:54:29+0000 Synthesized 90.91% of people - synthesized = 141,152, sf1 marginal = 155,261
Comparison against controls#
When examining the below plots, the column title refers to the kind of control variable - household (HH) or person (PERSON) level. Note that columns starting with TEST are not directly controlled to.
PUMA level#
Note that linear regression stats will be meaningless for a model with one PUMA only, as is the case here.
comp.generate_comparison_plots(geo_level=1)
Tract level#
comp.generate_comparison_plots(geo_level=0)
Total running time of the script: (0 minutes 9.610 seconds)