Urban-Analytics-Technology-Platform / acbm

activity-based modelling pipeline (for transport demand models)
https://github.com/Urban-Analytics-Technology-Platform/acbm/wiki
Apache License 2.0
5 stars 1 forks source link

Test stability of assignment algorithm #38

Open BZ-BowenZhang opened 3 months ago

BZ-BowenZhang commented 3 months ago

According to the discussion on 7th AUG between @BZ-BowenZhang @sgreenbury and @Hussein-Mahfouz, the difference between the assigning results across each run is needed to test and prove this algorithm's stability. This may involve at least two parts:

sgreenbury commented 1 month ago

I have started looking at this to see if the same RNG seed generates outputs deterministically.

It looks like the scripts up to 3.2.3 are currently deterministic but not for secondary locations with PAM.

sgreenbury commented 1 month ago

Exploring this would also be simplified through implementing #53 first

sgreenbury commented 1 month ago

From discussion with @BZ-BowenZhang and @Hussein-Mahfouz, we'd like to measure three things:

  1. Running with same seed, leads to identical outputs
  2. Running with different seeds, generates different stochastic samples from the pipeline's distribution. Invariance of properties will measure the stability.
  3. Running with different config and different seed generates outputs with different assumptions allowing a measure of the sensitivity.
Hussein-Mahfouz commented 1 month ago

@sgreenbury non determinism in 3.2.3_assign_secondary_zone.py may be due to the following:

sgreenbury commented 1 month ago

Thanks @Hussein-Mahfouz for identifying these calling random.choice(), I think that's it. I've updated the init_rng() method to include setting the seed for random too and this now produces deterministic outputs for a given seed. I'll open a PR!