Skip to content

Fixes bug for computing gradient #96

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bear-is-asleep
Copy link
Contributor

std(x) has a prefactor of 1/N, whereas cov(x,y) has a prefactor of 1/N-1. So we should use the covariance[0,0] to get the variance of x directly.

cov[0,1]/cov[0,0],cov[0,1]/np.std(df['seg_rrs'][ind])**2
>>> (np.float64(0.018677554097208945), np.float64(0.020375516343523768))

std(x) has a prefactor of 1/N, whereas cov(x,y) has a prefactor of 1/N-1. So we should use the covariance[0,0] to get the variance of x directly.

```
cov[0,1]/cov[0,0],cov[0,1]/np.std(df['seg_rrs'][ind])**2
>>> (np.float64(0.018677554097208945), np.float64(0.020375516343523768))
```
Copy link
Member

@francois-drielsma francois-drielsma left a comment

Choose a reason for hiding this comment

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

Can you put the gradient back on one line? I.e.

gradient = cov[0,1]/cov[0,0] if cov[0,0] > 0. else 0.

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