Skip to content

Conversation

nicolaspi
Copy link

@nicolaspi nicolaspi commented Aug 5, 2022

Subsumed by #1600

Hi, I got confused with the results of windowed_variance, it seems the documentation is wrong (same applies for windowed_mean).

low = np.maximum(np.arange(10) - 5, 0)
high = np.arange(10) + 5
x = np.arange(20, dtype=np.float32)
a = tfp.stats.windowed_variance(x, low_indices=low, high_indices=high)
b = [np.var(x[low[i]: high[i]+1]) for i in range(len(low))]
c = [np.var(x[low[i]: high[i]]) for i in range(len(low))]

np.testing.assert_almost_equal(a, c, decimal=5) # Ok
np.testing.assert_almost_equal(a, b, decimal=5) # Not Ok

@nicolaspi nicolaspi changed the title Fix doc of windowed_variance to match implementation Fix doc of windowed_mean|variance to match implementation Aug 7, 2022
@nicolaspi nicolaspi closed this Aug 8, 2022
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.

1 participant