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

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.1.1.tar.gz (6.5 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.1.1-py3-none-any.whl (6.4 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for econirl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e27b0b3290076f2e19f8e344c6e978b58fdb13567825de79f8dd6875e60f0bcf
MD5 e6986df7e45e746979a0f27ad3e88579
BLAKE2b-256 7db9a57b3ab5c66a1eea00f5eb267d8d346ad13c7e2a44da7b049784243c6c24

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for econirl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ffda3b40b4ac7c1f51210dc7b2dbb1ce933d0ec51e6466edd8dbe8415dde47d
MD5 b560acc80f8546000165c2ace46670c7
BLAKE2b-256 e90970fdb681a53e71a2a51f02bc03a7305cf88f19699880912e55130763c321

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.10

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