From cfa911105219dbd13789ecb196c40071d3252f08 Mon Sep 17 00:00:00 2001 From: Taylor Oshan Date: Mon, 28 Nov 2016 08:24:43 -0700 Subject: [PATCH 1/2] reformat output --- src/py/crankshaft/crankshaft/regression/gwr/gwr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/py/crankshaft/crankshaft/regression/gwr/gwr.py b/src/py/crankshaft/crankshaft/regression/gwr/gwr.py index 155b95b..5b273a7 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/gwr.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/gwr.py @@ -35,8 +35,8 @@ def gwr(subquery, dep_var, ind_vars, fixed=False, kernel='bisquare'): stand_errs = model.bse.reshape((-1)) predicted = np.repeat(model.predy.reshape((-1,)), k+1) residuals = np.repeat(model.resid_response.reshape((-1,)), k+1) - r_squared = np.tile(model.localR2.reshape((-1,)), k+1) + r_squared = np.repeat(model.localR2.reshape((-1,)), k+1) rowid = np.tile(rowid, k+1).reshape((-1,)) - var_name = np.tile(ind_vars, k+1).reshape((-1,)) - + ind_vars.insert(0, 'intercept') + var_name = np.tile(ind_vars, n).reshape((-1,)) return zip(coefficients, stand_errs, t_vals, predicted, residuals, r_squared, rowid, var_name) From c3e99cda3032a49c92df166f060c91bd196b2e01 Mon Sep 17 00:00:00 2001 From: Taylor Oshan Date: Mon, 28 Nov 2016 12:49:38 -0700 Subject: [PATCH 2/2] pysal.contrib -> crankshaft.regression --- .../crankshaft/regression/gwr/base/diagnostics.py | 2 +- src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py | 8 ++++---- .../crankshaft/crankshaft/regression/gwr/base/sel_bw.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py b/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py index 44a75d5..7fbcdc4 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/base/diagnostics.py @@ -4,7 +4,7 @@ Diagnostics for estimated gwr modesl __author__ = "Taylor Oshan tayoshan@gmail.com" import numpy as np -from pysal.contrib.glm.family import Gaussian, Poisson, Binomial +from crankshaft.regression.glm.family import Gaussian, Poisson, Binomial def get_AICc(gwr): """ diff --git a/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py b/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py index 0711c29..0438f5b 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/base/gwr.py @@ -10,10 +10,10 @@ from scipy.stats import t from kernels import * from diagnostics import get_AIC, get_AICc, get_BIC import pysal.spreg.user_output as USER -from pysal.contrib.glm.family import Gaussian, Binomial, Poisson -from pysal.contrib.glm.glm import GLM, GLMResults -from pysal.contrib.glm.iwls import iwls -from pysal.contrib.glm.utils import cache_readonly +from crankshaft.regression.glm.family import Gaussian, Binomial, Poisson +from crankshaft.regression.glm.glm import GLM, GLMResults +from crankshaft.regression.glm.iwls import iwls +from crankshaft.regression.glm.utils import cache_readonly fk = {'gaussian': fix_gauss, 'bisquare': fix_bisquare, 'exponential': fix_exp} ak = {'gaussian': adapt_gauss, 'bisquare': adapt_bisquare, 'exponential': adapt_exp} diff --git a/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py b/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py index 2c26d03..9ab1263 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py +++ b/src/py/crankshaft/crankshaft/regression/gwr/base/sel_bw.py @@ -11,7 +11,7 @@ __author__ = "Taylor Oshan Tayoshan@gmail.com" from kernels import * from search import golden_section, equal_interval, flexible_bw from gwr import GWR -from pysal.contrib.glm.family import Gaussian, Poisson, Binomial +from crankshaft.regression.glm.family import Gaussian, Poisson, Binomial import pysal.spreg.user_output as USER from diagnostics import get_AICc, get_AIC, get_BIC, get_CV from scipy.spatial.distance import pdist, squareform