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.0.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.0-py3-none-any.whl (6.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: econirl-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 01194fc320af0c19cd44fbf0589b279e2d80373a60e024f075c25eab8c93a577
MD5 a5d1fceb5c73f1c805ef02827f026a60
BLAKE2b-256 8848924b20a75b4d0ef0459adf613e629d525e45be4870f26b4890bdf94dda91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: econirl-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bef4e9ffeec1bea72c7bebfe9756d40c8955bb0022cdc4c52ad270a2e66dc95d
MD5 4b41892b8b54f601b6b27116a5f94f31
BLAKE2b-256 7e85dd9ab1fe2ed68f608859506446f2acb84fcd90a8f0fa9e19ddfed86c7b8f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

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