diff --git a/src/pg/sql/18_outliers.sql b/src/pg/sql/18_outliers.sql index 48588ce..7d4b3b2 100644 --- a/src/pg/sql/18_outliers.sql +++ b/src/pg/sql/18_outliers.sql @@ -1,5 +1,8 @@ + +-- Find outliers using a static threshold +-- CREATE OR REPLACE FUNCTION CDB_StaticOutlier(attr numeric, threshold numeric) -RETURNS numeric +RETURNS boolean AS $$ BEGIN @@ -8,6 +11,7 @@ BEGIN END; $$ LANGUAGE plpgsql; +-- Find outliers by a percentage above the threshold CREATE OR REPLACE FUNCTION CDB_PercentOutlier(attr numeric[], outlier_fraction numeric, ids int[]) RETURNS TABLE(outlier boolean, rowid int) @@ -29,6 +33,8 @@ BEGIN END; $$ 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[]) RETURNS TABLE(outlier boolean, rowid int) AS $$