-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ac/mcnnm #3
base: main
Are you sure you want to change the base?
Conversation
…uture compatibility
…expected in a simple case
NOTE: Built in collaboration with ChatGPT o3-mini-high | ||
|
||
""" | ||
def __init__(self, lambda_param=1e-3, max_iter=500, tol=1e-4, verbose=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good (and surprisingly simple!); would be good to parametrize whether to partial out FEs before fitting MC though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya. Can add the parameters, but got to decide the right way to pull them out. I couldn't come up with an elegant way that nested the intercept inclusion for the other methods, but maybe that is a problem for synth.py. Originally I was thinking maybe that can but upstream, but realized the FE will need to be iterative within each SVT iteration (if I recall correctly) so will need a mcnnm specific implementation.
Thanks for taking a crack at this; I've been down the LLM finetuning/evals mines lately and haven't been able to develop this much. Also I remember Susan and co's package does the iterative SVT work in C++; might be feasible to do the same via pyensmallen (or even directly use the c++ code in their library via pybind11). |
Ya, I started going down that rabbit hole. Here is the code explicitly https://github.com/susanathey/MCPanel/blob/master/src/mcnnm_R.cpp After trying a bit I did some research to try and figure it out, but got a bit stuck. It was suggested that a python binding might not be that much better for the base SVD which makes sense. We'd probably only benefit from binding the whole iterative SVT. Agree worth exploring those alternatives (alt packages AND porting the implementation from that package) for benchmarking. |
@apoorvalal how were you thinking about generalizing the syntax for Synth to MC, Vertical Reg and Horizintal Reg? I pulled out the _get_synthetic which seemed necessary given MC is less "weight" focused, but other comments before this merge? I figure we can connect MC with Synth in the next PR. |
…squeeze() caused issue in ADH notebook
…how results. Edit ADH notebook to highlight matching error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was a use of synth instead of matching_synth so the matching section wasn't actually using matching estimator. It threw an error when corrected, but I did not address it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Y, W,N_treated = convert_to_W(Y_treated, Y_control, T_pre) | ||
print("Y control std:",np.std(Y_control)) | ||
# Fit matrix completion model | ||
mcnnm = MatrixCompletionEstimator(lambda_param=1e+1, max_iter=500, tol=1e-8,verbose=verbose) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now added lambda that performed reasonable on ADH data. Need to add cross validation for lambda selection or consider alternative intelligent selection (printed std of Y above to consider, but did not use)
initial MC commit + refactor to centralize synthetic outcome creation for ease of integration with MC