diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-02-18 03:04:46 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-02-18 03:04:46 -0500 |
commit | 89e5192f1ee83ebb3a7bd87aefc5d23ce4ab2c2b (patch) | |
tree | 4cdc41b4750719c13eb8f6534fce879c577dbd88 /stats.py | |
parent | e37ed32d9b861581942ec5cfb8948f0602c0a481 (diff) |
Support for compacting binary data
Diffstat (limited to 'stats.py')
-rw-r--r-- | stats.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -13,6 +13,12 @@ def iqr(vect): | |||
13 | def cutoff_max(vect, percentile=99): | 13 | def cutoff_max(vect, percentile=99): |
14 | return s.scoreatpercentile(vect, percentile) | 14 | return s.scoreatpercentile(vect, percentile) |
15 | 15 | ||
16 | def iqr_cutoff(vect, extend): | ||
17 | (spread, low, high) = iqr(vect) | ||
18 | min_val = low - extend * spread | ||
19 | max_val = high + extend * spread | ||
20 | return min_val, max_val | ||
21 | |||
16 | def iqr_is_not_outlier(table, col=1, extend=1.5): | 22 | def iqr_is_not_outlier(table, col=1, extend=1.5): |
17 | "create a filter function that flags outliers" | 23 | "create a filter function that flags outliers" |
18 | (spread, low, high) = iqr(table[:,col]) | 24 | (spread, low, high) = iqr(table[:,col]) |