update tests

This commit is contained in:
Andy Eschbacher 2016-09-28 16:27:41 -04:00
parent b8accb48fc
commit acde384157
3 changed files with 14 additions and 7 deletions

View File

@ -27,7 +27,7 @@ BEGIN
SELECT array_agg(
CASE WHEN avg_val = 0 THEN null
ELSE outlier_fraction > i / avg_val
ELSE outlier_fraction < i::numeric / avg_val::numeric
END
) INTO out_vals
FROM unnest(attr) As x(i);

View File

@ -1,16 +1,22 @@
SET client_min_messages TO WARNING;
\set ECHO none
outlier|rowid
t|11
t|16
t|17
(3 rows)
outlier|rowid
t|16
t|17
(2 rows)
outlier|rowid
t|8
t|11
t|16
(3 rows)
outlier|rowid
t|8
t|9
t|11
t|15
t|16
(4 rows)

View File

@ -19,7 +19,7 @@ WITH a AS (
ARRAY[1,3,2,3,5,1,2,32,12, 3,57, 2, 1, 4, 2,100,-100]::numeric[] As vals, ARRAY[1,2,3,4,5,6,7, 8, 9,10,11,12,13,14,15, 16, 17]::int[] As ids
), b As (
SELECT
(cdb_StdDevOutlier(vals, 1.0, ids)).*
(cdb_crankshaft.cdb_StdDevOutlier(vals, 1.0, ids)).*
FROM a
ORDER BY ids)
SELECT *
@ -33,7 +33,7 @@ WITH a AS (
ARRAY[1,2,3,4,5,6,7, 8, 9,10,11,12,13,14,15, 16, 17]::int[] As ids
), b As (
SELECT
(CDB_StdDevOutlier(vals, 2.0, ids)).*
(cdb_crankshaft.CDB_StdDevOutlier(vals, 2.0, ids)).*
FROM a
ORDER BY ids)
SELECT *
@ -48,7 +48,7 @@ WITH a AS (
ARRAY[1,2,3,4,5,6,7, 8, 9,10,11,12,13,14,15, 16, 17]::int[] As ids
), b As (
SELECT
(CDB_PercentOutlier(vals, 2.0, ids)).*
(cdb_crankshaft.CDB_PercentOutlier(vals, 2.0, ids)).*
FROM a
ORDER BY ids)
SELECT *
@ -64,7 +64,8 @@ WITH a AS (
SELECT unnest(vals) As v, unnest(ids) as i
FROM a
)
SELECT CDB_StaticOutlier(v, 11.0), i
SELECT cdb_crankshaft.CDB_StaticOutlier(v, 11.0) As outlier, i As rowid
FROM b
WHERE CDB_StaticOutlier(v, 11.0) is True
WHERE cdb_crankshaft.CDB_StaticOutlier(v, 11.0) is True
ORDER BY i;