scikit-agent¶
scikit-agent is a scientific Python toolkit for agent-based economic modeling and multi-agent systems design. It provides a unified interface for creating, solving, and simulating economic models using modern computational methods including deep learning as well as more traditional numerical techniques.
Our goal is for scikit-agent to be for computational social scientific
modeling and statistics what scikit-learn is for machine learning.
Key Features¶
Built on Scientific Python and Torch for easy integration with the Python ecosystem
Modular modeling system. Construct multi-agent environments from modular blocks of structural equations.
Solution algorithms including deep learning methods.
Simulation tools for generating synthetic data and running policy experiments
Installation¶
pip install scikit-agent
For development installation:
git clone https://github.com/scikit-agent/scikit-agent.git
cd scikit-agent
pip install -e ".[dev,docs]"
Quick Example¶
import skagent as ska
from skagent.models.consumer import cons_problem, calibration
# A consumption-saving model: a consumption block chained with a
# tick block that carries end-of-period assets into next period's
# capital. The simulator constructs the shock distributions from
# the calibration internally.
model = cons_problem
# Define simple decision rule
decision_rules = {"c": lambda m: 0.9 * m}
# Run simulation
simulator = ska.MonteCarloSimulator(
calibration=calibration,
block=model,
dr=decision_rules,
initial={"k": 1.0},
agent_count=1000,
T_sim=50,
)
simulator.initialize_sim()
results = simulator.simulate()
Quick Links¶
Get up and running in minutes with your first economic model
Learn to build custom models using DBlocks and economic building blocks
Explore solution methods from value backwards induction to neural networks
Master Monte Carlo simulation and result analysis
Browse complete working examples and use cases
Detailed documentation of all classes and functions
Next Steps¶
New to scikit-agent? Start with the Quickstart Guide guide.
Want to dive deeper? Check out:
Block Guide for model building concepts
Examples for complete working examples
API Reference for detailed API documentation
Community & Support¶
GitHub Repository: github.com/scikit-agent/scikit-agent