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

Correct the way we compute variance covariance matrix #26

Merged
merged 6 commits into from
Aug 16, 2023

Conversation

zhengp0
Copy link
Member

@zhengp0 zhengp0 commented Aug 8, 2023

No description provided.

coef_index = self._get_coef_index(learner_id)
super_vcov[np.ix_(coef_index, coef_index)] += (
weight * self.learners[learner_id].vcov
super_vcov[np.ix_(coef_index, coef_index)] += weight * (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious what this extra np.outer term adds? If you don't mind explaining

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davidshaw-uw, the formula is from the law of total (co)variance.
https://en.wikipedia.org/wiki/Law_of_total_covariance
The first term is the expectation of the covariance, and the second term (np.outer) is the covariance of the expectation.

@zhengp0 zhengp0 merged commit f5c75d9 into main Aug 16, 2023
1 check passed
@zhengp0 zhengp0 deleted the feature/super_vcov branch August 16, 2023 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants