dowhy icon indicating copy to clipboard operation
dowhy copied to clipboard

Pass Solver and n_iter parameters in the model estimation step

Open ravitejar opened this issue 3 years ago • 4 comments

Do Why model estimation runs for a really long time while displaying warning messages such as below. I know other solvers like liblinear will have a quicker solution. How do I pass these parameters through the DoWhy package?

/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/sklearn/utils/validation.py:63: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). return f(*args, **kwargs) /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/sklearn/linear_model/_logistic.py:765: ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in: https://scikit-learn.org/stable/modules/preprocessing.html Please also refer to the documentation for alternative solver options: https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)

Code:: model = CausalModel( data=df_new, treatment="treatment" , outcome="y", common_causes=X_new.columns.tolist())

identified_estimand = model.identify_effect()

estimate_matching = model.estimate_effect(identified_estimand, method_name="backdoor.propensity_score_matching")

ravitejar avatar Jul 19 '22 19:07 ravitejar

This is a good idea. I can implement this in the next PR.

amit-sharma avatar Jul 23 '22 08:07 amit-sharma

Would it be possible to add the 'balanced' parameter of the Logistic Regression model as well? This solves the problem of imbalanced treatment labels to some extent

ravitejar avatar Jul 28 '22 07:07 ravitejar

What is the target launch date for this enhancement?

ravitejar avatar Aug 20 '22 20:08 ravitejar

thanks for your patience @ravitejar . Had planned it for v0.8 but we missed the target. This should be added within the next month to main, and then available in the subsequent release.

amit-sharma avatar Aug 22 '22 06:08 amit-sharma