MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / median

Method median

JSAT/src/jsat/linear/Vec.java:550–557  ·  view source on GitHub ↗

Returns the median value in this vector @return the median

()

Source from the content-addressed store, hash-verified

548 * @return the median
549 */
550 public double median()
551 {
552 Vec copy = sortedCopy();
553 if(copy.length() % 2 != 0)
554 return copy.get(copy.length()/2);
555 else
556 return copy.get(copy.length()/2)/2+copy.get(copy.length()/2+1)/2;
557 }
558
559 /**
560 * Computes the skewness of this vector, which is the 3rd moment.

Callers 7

testSampleAndStatsMethod · 0.95
testSampleMethod · 0.95
testSampleMethod · 0.95
testMedianMethod · 0.45
testMedianMethod · 0.45
testMedianMethod · 0.45
testSummaryStatsMethod · 0.45

Calls 3

sortedCopyMethod · 0.95
lengthMethod · 0.95
getMethod · 0.95

Tested by 7

testSampleAndStatsMethod · 0.76
testSampleMethod · 0.76
testSampleMethod · 0.76
testMedianMethod · 0.36
testMedianMethod · 0.36
testMedianMethod · 0.36
testSummaryStatsMethod · 0.36