EconML icon indicating copy to clipboard operation
EconML copied to clipboard

Changing categories and refit_final

Open vsyrgkanis opened this issue 2 years ago • 1 comments

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.

vsyrgkanis avatar Sep 18 '23 17:09 vsyrgkanis

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.

kbattocchi avatar Oct 05 '23 17:10 kbattocchi