Skip to content
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

WeightedModelWrapper issue with linear models with intercept #63

Closed
vsyrgkanis opened this issue May 27, 2019 · 2 comments
Closed

WeightedModelWrapper issue with linear models with intercept #63

vsyrgkanis opened this issue May 27, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@vsyrgkanis
Copy link
Collaborator

vsyrgkanis commented May 27, 2019

It might be that the weighted model wrapper has a small bug in the case of linear models that fit an intercept:

def _weighted_inputs(self, X, y, sample_weight):
    normalized_weights = X.shape[0] * sample_weight / np.sum(sample_weight)
    sqrt_weights = np.sqrt(normalized_weights)
    weight_mat = np.diag(sqrt_weights)
    return np.matmul(weight_mat, X), np.matmul(weight_mat, y)

If there is an intercept then we also want the intercept to be multiplied by the weight, so this transformation would be invalid. The user can fix it by augmenting X with an intercept and then calling a linear model without intercept. But this might be cumbersome.

@vasilismsr vasilismsr added the bug Something isn't working label May 27, 2019
@kbattocchi
Copy link
Collaborator

I agree that this could be an issue, but it's not clear to me how we might fix it - as far as I can see there's no simple transformation of X and y that will work when fitting a model with an intercept. Do you have any suggestions?

@vasilismsr vasilismsr added this to To do in bugs Oct 1, 2019
@vasilismsr vasilismsr added this to In progress in Double Machine Learning Oct 2, 2019
@vasilismsr
Copy link
Contributor

#75 Addressed this.

bugs automation moved this from To do to Done Nov 6, 2019
Double Machine Learning automation moved this from In progress to Done Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
bugs
  
Done
Development

No branches or pull requests

5 participants