econirl
EconIRL is a Python package for structural dynamic discrete choice and inverse reinforcement learning. Use it to estimate forward-looking choice models, recover rewards, and evaluate counterfactual policies.
Install
pip install econirl
Estimators
Open the estimator that matches your decision problem.
NFXP · CCP · MPEC · UFXP · NNES · TD-CCP · MCE-IRL · Deep MCE-IRL · AIRL · AIRL-Het · f-IRL · GLADIUS · IQ-Learn
Example
from econirl.datasets import load_rust_bus
from econirl import NFXP
df = load_rust_bus()
model = NFXP(n_states=90, discount=0.9999, utility="linear_cost")
model.fit(df, state="mileage_bin", action="replaced", id="bus_id")
print(model.params_)
cf = model.counterfactual(RC=4.0)
print(cf.policy[50, 1])
Output
{'theta_c': 0.0010028828858836278, 'RC': 3.0722093435989524}
0.05519477716656161