This repository was archived by the owner on Feb 2, 2024. It is now read-only.
Merged
Conversation
Collaborator
|
You could optimize it further. The formula for variance is: So, you could implement variance as: square_sum = 0.
sum = 0.
total_count = 0
for i in prange(len):
a = self._data[i]
if not isnan(a):
square_sum += a*a
sum += a
total_count += 1
if total_count < 1:
return numpy.nan
return (square_sum - sum*sum/total_count)/total_countAlso you could see covariance as an example Also, haven't validate the final formula. So there could be errors |
Add perf test for var with skipna=True Add numpy_like var Add numpy_like nanmean Add test for numpy_like.nanvar Add perf test for numpy_like.nanvar Add perf test for Series.std(skipna=True)
AlexanderKalistratov
approved these changes
Feb 19, 2020
Contributor
Author
I will implement it in separate PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only
varis implemented yet.This PR is based on #610 because used parallel
nanmean.stdautoscaleup becauseSeries.stdis implemented viaSeries.var. @densmirn thank you :)