Open federiconuta opened 3 years ago
Could you provide a full stack trace? Is the warning definitely arising from the fitting of SparseLinearDML
's final model, or could it be from fitting one of the first-stage models? That warning is generated by sklearn when the gap remains above the tolerance, but in this case they both round down to 0.0
so it's hard to know how far from convergence you are, but it may not really be a problem at all.
As an aside, if both of your first stage models are using variations of ElasticNet
then linear_first_stages
should ideally be set to true so for correctness.
@kbattocchi
Could you provide a full stack trace? Is the warning definitely arising from the fitting of SparseLinearDML's final model, or could it be from fitting one of the first-stage models?
Actually I moved from SparseLinearDML
to LinearDML
with auto
inference and the problem does not arise. Apparently the problem with SparseLinearDML
arises when inputting the X value of dummies which I constructed as follows:
for g in np.arange(n_groups):
for i in np.arange(n_products_per_group):
for j in np.arange(n_months):
index_i = n_products_per_group*g + i
minus_i = (np.arange(n_products) >= (n_products_per_group*g))
minus_i &= (np.arange(n_products) < (n_products_per_group*(g+1)))
minus_i &= (np.arange(n_products) != (index_i))
p_minus[index_i, j] = np.mean(p[minus_i, j])
X[index_i, j, :(n_products)] = 1.0 * (np.arange(0, n_products) == (index_i))
X[index_i, j, (n_products):(n_products + n_groups - 1)] = 1.0 * (np.arange(1, n_groups) == g)
X[index_i, j, (n_products + n_groups - 1):] = 1.0 * (np.arange(1, n_months) == j)
Consider that I then fit only a portion of X:
est.fit(Y, T=T, X=X[:, :(n_products)], W=W, inference='auto')
which consists of a series of dummy for each period. The problem of Objective not converge does not arise if I do not employ such X. I also tries with fit_cate_intercept=False
and linear_first_stages=False
or increasing both the number of alphas and tolerance. Actually I cannot change my X. Do you think that using LinearDML
would affect the results considering that I am including time dummies and individual dummies?
Thank you!
The error on the title appears when I fit the following model:
I actually increased a lot the number of iterations so I don't know what's wrong. Can you please help me figuring out this?
Thank you