Skip to content

Conversation

@Mind-the-Cap
Copy link
Contributor

@Mind-the-Cap Mind-the-Cap commented Dec 22, 2025

  • New classes Parameter and ParameterSet to better manage parameters of the model

Normally ensures compatibility with existing scripts, but I'm not merging, as it changes the way parameters are I want to have a discussion on that before merging!

  • Improvements for quickstart
  • Move old classes to a legacy folder
  • New default parameters for modes and motives (to improve with future calibration)
  • Add a class MultiSeedPopulationTrips to get results using multiple seeds while not complicating PopulationTrips too much
  • Add WorkHomeFlows_fr class to compare with INSEE flows
  • Use this INSEE data to create a SSI function (Sørensen similarity index)

New classes Parameter and ParameterSet to better manager parameters of the model
@Mind-the-Cap Mind-the-Cap linked an issue Dec 22, 2025 that may be closed by this pull request
@Mind-the-Cap Mind-the-Cap changed the title Parameter class Improvements for quickstart and parameters Dec 22, 2025
* bug quickfix for small radiuses in get_prominent_cities
* better legend in plot_od_flows (still have to improve it)
* ability to save OD flows as an image (in local folder for now, to improve)
MultiSeedPopulationTrips with some test code
@Mind-the-Cap Mind-the-Cap changed the title Improvements for quickstart and parameters Various winter improvements Dec 31, 2025
@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.42%. Comparing base (c8c3ac3) to head (cfd4891).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #242   +/-   ##
=======================================
  Coverage   70.42%   70.42%           
=======================================
  Files          56       56           
  Lines        2424     2424           
=======================================
  Hits         1707     1707           
  Misses        717      717           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 0.9999999 default value seems too high to me ? 0.99986 comes from the radiation model with selection paper from Simini (https://arxiv.org/pdf/1206.4359).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was the value I found using tests, but we will need to run proper tests soon anyway on diverse territories, so we can discuss best value later!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK we will have to validate this, because 0.9999999 probably means we remove all short ODs, because they will not be sampled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make a single PopulationTrips class with the option to have multiple seeds ? We probably should remove all the main as this should not run as a script anyway ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to discuss it! I hesitated for a long time indeed, here's why having a proper class was my option:

  • We still hope to have good results with using a single seed, ie not only use cases will imply multiple seeds
  • Using multiple seeds would mean we have to rewrite every function in PopulationTrips, which is a big change and creates a long file
  • On the opposite, by having a MultiSeedPopulationTrips, we can have a clear class for that purpose, which uses PopulationsTrips as it is and keeps it stable. That also opens the door to MultiParamsPopulationTrips (one single seed but slightly different value of costs of time for example), which could be useful for future research
    (Once we agree on the solution, we can obviously remove the "if name == "main":" part)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking was that single seed is just a special case of multiple seed ?

I wonder if we could modify the Asset class to handle parametric inputs automatically, so we don't need a special class every time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k_mode_sequences=42 ? What's the idea here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a test, we can switch back to a lower value (but we'll need to test the sensibility to that soon)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think WorkplaceByResidenceCounts would be a better name ? INSEE does not really give flows. Maybe remove the fr suffix, create a generic class and then have methods for each country / source ? Like in https://github.com/mobility-team/mobility/blob/main/mobility/population.py. We should be able to use swiss Statent data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also avoid the name == "main" block as this should not run as a script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INSEE urls are unstable, so we should copy the files on data.gouv.fr first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with the comments, I will do these changes asap.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

25 seems huge, except if you want to exclude bicycle as a mode ? It means that cycling will get a 0 % probability of being selected for nearly all comparisons with the other modes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bicycle was really overrepresented otherwise. We'll need to investigate that in the near future!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good first version ! I think we can avoid the post_init / dict serialization. Should I take this in a separate PR ? I think it's substantial enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Organiser les paramètres du modèle

2 participants