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()
Traceback (most recent call last):
File "/home/jamie/git/anl/polarislib/docs/examples/result_analysis/plot_population_synthesis_analysis.py", line 22, in <module>
comp = PopsynComparator(iteration_folder, sample_factor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jamie/git/anl/polarislib/polaris/analyze/popsyn_analysis.py", line 42, in __init__
self.polaris_inputs = PolarisInputs.from_dir(result_dir, db_name, use_parent_supply=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jamie/git/anl/polarislib/polaris/runs/polaris_inputs.py", line 24, in from_dir
raise FileNotFoundError(f"No such directory {dir}")
FileNotFoundError: No such directory /tmp/Bloomington/Bloomington_iteration_4
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 0.208 seconds)