Open Shafi2016 opened 4 years ago
Thanks for the bug report. I believe this behavior is by design, but I can see how it is confusing. The random_state argument to our estimators controls their internal use of randomness (in the case of the DML estimators, this involves how samples are split into folds for cross-fitting). If the submodels used are deterministic, then the output will be deterministic; however, if the submodels themselves use randomness then you will need to control that as well to get an overall deterministic result. In your case, this means that you need to also pass a fixed random_state argument to each RandomForestRegressor. Does that make sense?
Thank you so much!! It works fine by using random_state in each of the model_y,model_t and LinearDMLCateEstimator.
Thanks for the very nice work!
I am running a basic model as the codes given below. I am getting different results when running these codes each time even though with random_state is fixed to 504
est = LinearDMLCateEstimator(model_y=RandomForestRegressor(),model_t=RandomForestRegressor(),n_splits= 2, random_state= 504) est.fit(Y, T, X, W,inference='statsmodels') te_pred=est.effect(X_test) te_pred_interval = est.const_marginal_effect_interval(X_test, alpha=0.05)