Skip to main content

econirl

PyPI version

Structural dynamic discrete choice and inverse reinforcement learning in Python.

EconIRL helps estimate forward-looking choice models, recover reward functions, and evaluate counterfactual policies from panel data.

Documentation: https://econirl.readthedocs.io/

Install

pip install econirl

Quick Start

from econirl.datasets import load_rust_bus, rust_bus_reward_spec
from econirl import NFXP

df = load_rust_bus()

model = NFXP(n_states=90, discount=0.9999, utility=rust_bus_reward_spec(90))
model.fit(df, state="mileage_bin", action="replaced", id="bus_id")

print(model.params_)

cf = model.counterfactual(replacement_cost=4.0)
print(cf.policy[50, 1])

Example output:

{'operating_cost': 0.001002924937407198, 'replacement_cost': 3.072263682263484}
0.055196266692073837

Public Estimator Guides

The public docs split the estimators into a core roster and the rest. NFXP is the reference within the core, the exact estimator we replicate to Rust (1987) Table IX. See Choosing an Estimator for how the methods relate.

Core: NFXP, CCP, TD-CCP, MCE-IRL, Neural MCE-IRL, AIRL (AIRL-1), AIRL-Het (AIRL-2), and GLADIUS. GLADIUS is the package's neural estimator, the GLADIUS class is the NeuralGLADIUS implementation.

Other: NNES, MPEC, UFXP, RHIP, f-IRL, IQ-Learn, and the contrib baselines. These are available for advanced users and method development.

Package Surface

The recommended API is sklearn-style:

from econirl import NFXP, CCP, NNES, TDCCP, MCEIRL, RHIP, AIRL, GLADIUS

Additional estimators and lower-level configuration objects are available under econirl.estimation, econirl.estimators, and econirl.contrib for advanced workflows.

Repository Layout

  • src/econirl/: package source.
  • tests/: unit, integration, and validation-evidence tests.
  • docs/: public Read the Docs source.
  • validation/: reproducible validation runners and machine-readable results.
  • examples/: public examples and notebooks.

Manuscripts, PDFs, local research workspaces, and assistant-specific notes are not tracked in this public package repository.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

econirl-0.0.10.tar.gz (6.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

econirl-0.0.10-py3-none-any.whl (6.3 MB view details)

Uploaded Python 3

File details

Details for the file econirl-0.0.10.tar.gz.

File metadata

  • Download URL: econirl-0.0.10.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for econirl-0.0.10.tar.gz
Algorithm Hash digest
SHA256 6f98ee7f586795541292ebe1f4616b61993b0208acd0723d5ee50f9d11718182
MD5 756ebe1156e691acdefa8a07cc8727e2
BLAKE2b-256 4723c69012ba8d27421433f10bc764680d889ff23950596dd1a11bc1dde68c44

See more details on using hashes here.

File details

Details for the file econirl-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: econirl-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for econirl-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 76b20887505d4fad1e485711f6f8a72c93712525db4f6da45c66bf32dff2b016
MD5 2a92cd05099f512b117e699bf61aee0e
BLAKE2b-256 56874d6609f69b2dd82493adc8ab34270c2c2c67dc2adbb49fff6b01c49b94b1

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

0.1.0

2 files

This release

0.0.10 This release

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page