EconML
EconML copied to clipboard
Changing categories and refit_final
If one changes the categories and refits the final, nothing changes
est = LinearDML(discrete_treatment=True).fit(Y, T, X=X, cache_values=True)
est.categories = [0, 1]
est.refit_final()
The result doesn't use the categories at all. One could even do est.categories = [0, 1, 2] and it wouldn't throw an error.
Most probably refit_final should not be allowed if one changes the categories.
At one point, we were considering an alternate approach to refitting where we kept track of which attributes were modified and prevented refitting if they would invalidate the results; however, we ultimately decided to go with the current approach, which puts the burden on the user to ensure that they only make changes that are compatible with refitting.