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, MCE-IRL, Neural MCE-IRL, AIRL, NeuralAIRL, and GLADIUS. GLADIUS is the package's neural estimator, the GLADIUS class is the NeuralGLADIUS implementation.

Other: TD-CCP, AIRL2, and every other implemented estimator outside Core. See the exhaustive Other Estimators list.

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

Metadata

Release files for econirl 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for econirl 0.1.1
File Size Uploaded
econirl-0.1.1.tar.gz 6.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for econirl 0.1.1
File Interpreter ABI Platform
econirl-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 MB

Release files / econirl-0.1.1.tar.gz

Download URL econirl-0.1.1.tar.gz
Size 6.5 MB
Tags Source
SHA-256 checksum
How to use checksums
e27b0b3290076f2e19f8e344c6e978b58fdb13567825de79f8dd6875e60f0bcf
BLAKE2b-256 checksum
How to use checksums
7db9a57b3ab5c66a1eea00f5eb267d8d346ad13c7e2a44da7b049784243c6c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release files / econirl-0.1.1-py3-none-any.whl

Download URL econirl-0.1.1-py3-none-any.whl
Size 6.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
3ffda3b40b4ac7c1f51210dc7b2dbb1ce933d0ec51e6466edd8dbe8415dde47d
BLAKE2b-256 checksum
How to use checksums
e90970fdb681a53e71a2a51f02bc03a7305cf88f19699880912e55130763c321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page