dowhy
dowhy copied to clipboard
Pass Solver and n_iter parameters in the model estimation step
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")
This is a good idea. I can implement this in the next PR.
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
What is the target launch date for this enhancement?
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.