Skip to content

Median diff improved#6

Open
0xparashar wants to merge 3 commits into
alyssaq:masterfrom
0xparashar:medianDiff-Improved
Open

Median diff improved#6
0xparashar wants to merge 3 commits into
alyssaq:masterfrom
0xparashar:medianDiff-Improved

Conversation

@0xparashar

Copy link
Copy Markdown

The last median diff function was not working in the following cases:
1: When the outlier is the first element in array
2: When there are two or more consecutive outliers within the same range, like 58, 54.
3: Also it used to remove the element following the outlier too, due to which there was data loss, which has also been fixed

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #6 into master will decrease coverage by -0.61%.
The diff coverage is 98.95%.

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
- Coverage     100%   99.39%   -0.61%     
==========================================
  Files           2        2              
  Lines         144      166      +22     
  Branches       13       19       +6     
==========================================
+ Hits          144      165      +21     
- Misses          0        1       +1
Impacted Files Coverage Δ
test.js 100% <100%> (ø)
stats.js 98.92% <98.92%> (-1.08%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8407d7d...fc38866. Read the comment docs.

@alyssaq

alyssaq commented Feb 25, 2017

Copy link
Copy Markdown
Owner

Hi

MedianDifferencing is meant to remove numbers where the difference between consecutive numbers is higher than the median. If 2 numbers say 58, 56 are next to each other, it would not be an outlier under this method.

You'll want to use the other outlier method MAD that doesnt care about order.
stats.indexOfOutliers(arr, stats.outlierMethod.MAD)

@0xparashar

Copy link
Copy Markdown
Author

Okay, but the number just after the outlier also get deleted, since the difference for it will also be higher with outlier, which is the reason of data loss

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.

3 participants