predict -> class framework

This commit is contained in:
Andy Eschbacher 2017-01-06 10:36:40 -05:00
parent 92fc25f6b5
commit e2cf12aaba

View File

@ -1,7 +1,10 @@
CREATE OR REPLACE FUNCTION
CDB_GWR(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, predicted numeric, residuals numeric, r_squared numeric, bandwidth numeric, rowid bigint)
bw numeric default null, fixed boolean default False,
kernel text default 'bisquare')
RETURNS table(coeffs JSON, stand_errs JSON, t_vals JSON,
predicted numeric, residuals numeric, r_squared numeric,
bandwidth numeric, rowid bigint)
AS $$
from crankshaft.regression import GWR
@ -17,11 +20,13 @@ 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)
RETURNS table(coeffs JSON, stand_errs JSON, t_vals JSON,
r_squared numeric, predicted numeric, rowid bigint)
AS $$
from crankshaft.regression import gwr_cs
from crankshaft.regression import GWR
gwr = GWR()
return gwr_cs.gwr_predict(subquery, dep_var, ind_vars, bw, fixed, kernel)
return gwr.gwr_predict(subquery, dep_var, ind_vars, bw, fixed, kernel)
$$ LANGUAGE plpythonu;