consolidate gwr sql functions

This commit is contained in:
Andy Eschbacher 2017-01-05 14:24:10 -05:00
parent d95ca54cdc
commit ba54e9b42d
2 changed files with 14 additions and 11 deletions

View File

@ -11,3 +11,17 @@ gwr = GWR()
return gwr.gwr(subquery, dep_var, ind_vars, bw, fixed, kernel)
$$ LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION
CDB_GWR_Predict(subquery text, dep_var text, ind_vars text[],
bw numeric default null, fixed boolean default False,
kernel text default 'bisquare')
RETURNS table(coeffs JSON, stand_errs JSON, t_vals JSON, r_squared numeric, predicted numeric, rowid bigint)
AS $$
from crankshaft.regression import gwr_cs
return gwr_cs.gwr_predict(subquery, dep_var, ind_vars, bw, fixed, kernel)
$$ LANGUAGE plpythonu;

View File

@ -1,11 +0,0 @@
CREATE OR REPLACE FUNCTION
CDB_GWR_PREDICT(subquery text, dep_var text, ind_vars text[],
bw numeric default null, fixed boolean default False, kernel text default 'bisquare')
RETURNS table(coeffs JSON, stand_errs JSON, t_vals JSON, r_squared numeric, predicted numeric, rowid bigint)
AS $$
from crankshaft.regression import gwr_cs
return gwr_cs.gwr_predict(subquery, dep_var, ind_vars, bw, fixed, kernel)
$$ LANGUAGE plpythonu;