facebookresearch / balance

The balance python package offers a simple workflow and methods for dealing with biased data samples when looking to infer from them to some target population of interest.
https://import-balance.org
GNU General Public License v2.0
681 stars 40 forks source link

Update ipw.py - attempted to remove glmnet #77

Closed talgalili closed 3 months ago

talgalili commented 5 months ago

Using calude 3 opus

In this rewritten version:

The cvglmnet and related functions have been replaced with sklearn's LogisticRegression and GridSearchCV for model fitting and hyperparameter tuning. The choose_regularization function has been removed since sklearn handles regularization differently. The cv_glmnet_performance function has been replaced with cv_logistic_regression_performance to extract performance metrics from GridSearchCV. The weights_from_link function remains the same. The rest of the code structure and functionality remains largely the same. This version should work without the need for glmnet_python and cvglmnet packages.