fix: return 0 for constant input in incr/skewness and incr/kurtosis#13197
fix: return 0 for constant input in incr/skewness and incr/kurtosis#13197apoorva-01 wants to merge 1 commit into
incr/skewness and incr/kurtosis#13197Conversation
|
Hello! Thank you for your contribution to stdlib. We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
👋 Hi there! 👋 And thank you for opening your first pull request! We will review it shortly. 🏃 💨 Getting Started
Next Steps
Running Tests LocallyYou can use # Run tests for all packages in the math namespace:
make test TESTS_FILTER=".*/@stdlib/math/.*"
# Run benchmarks for a specific package:
make benchmark BENCHMARKS_FILTER=".*/@stdlib/math/base/special/sin/.*"If you haven't heard back from us within two weeks, please ping us by tagging the "reviewers" team in a comment on this PR. If you have any further questions while waiting for a response, please join our Zulip community to chat with project maintainers and other community members. We appreciate your contribution! Documentation Links |
Both accumulators divide by a power of the second central moment M2, which is 0 for constant input, giving 0/0 = NaN. Guard a zero M2 and return 0 in both the update and query paths. Signed-off-by: Apoorva Verma <vermaapoorva0510@gmail.com>
62345b3 to
eda7d6d
Compare
Resolves #287.
@stdlib/stats/incr/skewnessand@stdlib/stats/incr/kurtosisreturningNaNinstead of0when every value is equal.The accumulators divide by a power of the second central moment
M2. For constant inputM2is exactly0, so it's a0/0division (NaN). The expected value for a constant data set is0(same as the pandas reference in the issue). The fix guards a zeroM2in both accumulators, in the running-update and no-argument query paths. These two are the onlystats/incrpackages doing this division;incr/nanskewnesswraps skewness and inherits it,incr/summarystill passes.Related Issues
Checklist