small fixes

This commit is contained in:
Andy Eschbacher 2016-09-26 16:51:22 -04:00
parent aaa36569de
commit f2bb0b496b

View File

@ -1,5 +1,8 @@
-- Find outliers using a static threshold
--
CREATE OR REPLACE FUNCTION CDB_StaticOutlier(attr numeric, threshold numeric) CREATE OR REPLACE FUNCTION CDB_StaticOutlier(attr numeric, threshold numeric)
RETURNS numeric RETURNS boolean
AS $$ AS $$
BEGIN BEGIN
@ -8,6 +11,7 @@ BEGIN
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
-- Find outliers by a percentage above the threshold
CREATE OR REPLACE FUNCTION CDB_PercentOutlier(attr numeric[], outlier_fraction numeric, ids int[]) CREATE OR REPLACE FUNCTION CDB_PercentOutlier(attr numeric[], outlier_fraction numeric, ids int[])
RETURNS TABLE(outlier boolean, rowid int) RETURNS TABLE(outlier boolean, rowid int)
@ -29,6 +33,8 @@ BEGIN
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
-- Find outliers above a given number of standard deviations from the mean
CREATE OR REPLACE FUNCTION CDB_StdDevOutlier(attrs numeric[], num_deviations numeric, ids int[]) CREATE OR REPLACE FUNCTION CDB_StdDevOutlier(attrs numeric[], num_deviations numeric, ids int[])
RETURNS TABLE(outlier boolean, rowid int) RETURNS TABLE(outlier boolean, rowid int)
AS $$ AS $$