Skip to content

Conversation

@Nithurshen
Copy link

Summary

This PR adds a new example, surrogate_modeling, which demonstrates how to integrate Mesa with Scikit-learn to create an emulator (surrogate model). This allows users to approximate the behavior of a complex Agent-Based Model (ABM) across a high-dimensional parameter space using only a small number of actual simulation runs.

Motive

Computational expense is a common bottleneck in ABM research, especially during calibration or sensitivity analysis. This PR offloads these concerns to Scikit-learn and Scipy to provide users with a robust workflow for efficient experimentation.

Implementation

  • The example is self-contained in examples/surrogate_modeling/ to demonstrate integration without modifying the core library.
  • Avoided batch_run and DataCollector in favor of manual Python loops to align with Mesa 4.0 roadmap.

Usage Examples

Users can run the entire pipeline from sampling to prediction with a single command:

python -m examples.surrogate_modeling.analysis
Running simulations for training data...
Surrogate model trained.

Prediction for {'n': 65, 'width': 22, 'height': 22}:
Approximated Gini: 0.6262

Additional Notes

  • Added a new optional dependency group surrogate in pyproject.toml including scikit-learn.

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.

1 participant