Skip to content

Improve test stability #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: estimation_enhancements
Choose a base branch
from

Conversation

jpn--
Copy link
Collaborator

@jpn-- jpn-- commented Dec 27, 2024

This pull request includes several changes to the activitysim/estimation module, primarily focusing on updating the larch version handling, modifying test cases, and adjusting model parameters.

The key change is applying a constraint on the trip model choice model, to solve an over specification problem and ensure the estimation results are stable.

The most important changes are grouped by their themes below.

Test Case Adjustments:

  • Added a condition in the test_location_model function to lock a parameter and set a cap for the "trip_destination" model to ensure model identifiability.
  • Modified the test_simple_simulate function in activitysim/estimation/test/test_larch_estimation.py to also use the "SLSQP" method for the "trip_destination" model. The SLSQP algorithm obeys constraints on parameter values, while the BHHH algorithm does not, yielding very different answers. Which is "better" depends on the modeler's opinion on the validity of the constraints.

Version Handling:

  • Updated the larch version check in activitysim/estimation/larch/__init__.py to handle development versions correctly.

Model Parameter Updates:

  • Updated the log-likelihood values in test_loc_trip_destination_BHHH_loglike.csv and test_loc_trip_destination_SLSQP_loglike.csv to reflect new model results. [1] [2]
  • Added new size specifications for the "trip_destination" model in test_loc_trip_destination_SLSQP_size_spec.csv.

CSV File Updates:

  • Updated parameter values in test_location_model_trip_destination_BHHH_None_.csv to reflect new model results.
  • Added a new CSV file test_location_model_trip_destination_SLSQP_None_.csv with updated parameter values for the "trip_destination" model.

jpn-- and others added 16 commits December 22, 2024 19:07
* limit multimethod version to 2.0 and earlier

* add multimethod version to other settings

* [makedocs] update installer download link

* [makedocs] update branch docs
* use libmamba solver

* add permissions [makedocs]

* add write permission for dev docs [makedocs]

* conda-solver: classic
* use libmamba solver

* add permissions [makedocs]

* add write permission for dev docs [makedocs]

* conda-solver: classic

* include workflow dispatch option for tests

* update release instructions

* add installer build to instructions

* Pin mamba for now, per conda-incubator/setup-miniconda#392

* conda-remove-defaults
…on_enhancements

# Conflicts:
#	conda-environments/activitysim-dev-base.yml
#	conda-environments/activitysim-dev.yml
#	conda-environments/docbuild.yml
#	conda-environments/github-actions-tests.yml
#	pyproject.toml
* fix link

* allow failure to import larch

* workflow

* blacken

* try some pins

* speed up docbuild

* use pandas 2 for docs

* oops wrong file

* restore foundation
@jpn-- jpn-- requested a review from Copilot March 31, 2025 19:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves test stability for the estimation module by updating model parameter constraints, modifying test cases, and adjusting version checks. Key changes include adjusting parameter locking in the trip destination model tests, updating larch version handling to correctly process development versions, and updating documentation and CI configuration files.

Reviewed Changes

Copilot reviewed 17 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/users-guide/estimation-mode/general.md Added documentation for using Larch and fixed a typo in the parameter name for optimization.
conda-environments/* Updated dependencies by adding a multimethod version constraint.
activitysim/estimation/test/test_larch_estimation.py Adjusted test cases to use the SLSQP algorithm and applied a parameter lock for the trip destination model.
activitysim/estimation/larch/location_choice.py Improved handling of alternative availability by adding an optional availability expression parameter.
activitysim/estimation/larch/init.py Modified version check logic to account for development versions of larch.
activitysim/core/workflow/tracing.py Revised table selection for tracing by preferring proto tables when available.
activitysim/abm/models/disaggregate_accessibility.py Changed deregistration of traceable tables to drop all proto-related tables.
HOW_TO_RELEASE.md Updated release instructions including tagging and environment handling commands.
.github/workflows/* Updated GitHub Actions configuration with new setup options and tooling versions.
Files not reviewed (6)
  • activitysim/estimation/test/test_larch_estimation/test_loc_trip_destination_BHHH_loglike.csv: Language not supported
  • activitysim/estimation/test/test_larch_estimation/test_loc_trip_destination_SLSQP_loglike.csv: Language not supported
  • activitysim/estimation/test/test_larch_estimation/test_loc_trip_destination_SLSQP_size_spec.csv: Language not supported
  • activitysim/estimation/test/test_larch_estimation/test_location_model_trip_destination_BHHH_None_.csv: Language not supported
  • activitysim/estimation/test/test_larch_estimation/test_location_model_trip_destination_SLSQP_None_.csv: Language not supported
  • docs/gettingstarted.rst: Language not supported
Comments suppressed due to low confidence (1)

docs/users-guide/estimation-mode/general.md:31

  • Typo found: 'mathod' should be corrected to 'method' to accurately reflect the intended argument name.
The `larch.Model.estimate` method allows the user to specify the optimization algorithm to use via the `mathod` argument, which can be set to 'BHHH', 'SLSQP', or any other algorithm ...

```sh
bump2version patch --new-version 1.2.3 --list
git -a v1.2.3 -m "Release v1.2.3"
Copy link
Preview

Copilot AI Mar 31, 2025

Choose a reason for hiding this comment

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

The git command for tagging a release appears to be incorrect. It should likely use 'git tag -a v1.2.3 -m "Release v1.2.3"' instead of 'git -a v1.2.3 -m "Release v1.2.3"'.

Suggested change
git -a v1.2.3 -m "Release v1.2.3"
git tag -a v1.2.3 -m "Release v1.2.3"

Copilot uses AI. Check for mistakes.

jpn-- and others added 12 commits March 31, 2025 15:51
…on_enhancements

# Conflicts:
#	activitysim/estimation/larch/__init__.py
#	activitysim/estimation/larch/cdap.py
#	activitysim/estimation/larch/general.py
#	activitysim/estimation/larch/location_choice.py
#	activitysim/estimation/larch/mode_choice.py
#	activitysim/estimation/larch/nonmand_tour_freq.py
#	activitysim/estimation/larch/scheduling.py
#	activitysim/estimation/larch/simple_simulate.py
#	activitysim/estimation/larch/stop_frequency.py
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.

6 participants