From 77b72173680bdf3936ca8366887cc376bb8a9879 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Tue, 29 Nov 2016 15:51:59 -0500 Subject: [PATCH] force array data types --- src/py/crankshaft/crankshaft/regression/gwr_cs.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/py/crankshaft/crankshaft/regression/gwr_cs.py b/src/py/crankshaft/crankshaft/regression/gwr_cs.py index 5be4630..085640e 100644 --- a/src/py/crankshaft/crankshaft/regression/gwr_cs.py +++ b/src/py/crankshaft/crankshaft/regression/gwr_cs.py @@ -36,12 +36,12 @@ def gwr(subquery, dep_var, ind_vars, # TODO: should x, y be centroids? point on surface? # lat, long coordinates - x = np.array(query_result[0]['x']) - y = np.array(query_result[0]['y']) + x = np.array(query_result[0]['x'], dtype=float) + y = np.array(query_result[0]['y'], dtype=float) coords = zip(x, y) # extract dependent variable - Y = np.array(query_result[0]['dep_var']).reshape((-1, 1)) + Y = np.array(query_result[0]['dep_var'], dtype=float).reshape((-1, 1)) n = Y.shape[0] k = len(ind_vars) @@ -50,7 +50,7 @@ def gwr(subquery, dep_var, ind_vars, for attr in range(0, k): attr_name = 'attr' + str(attr + 1) X[:, attr] = np.array( - query_result[0][attr_name]).flatten() + query_result[0][attr_name], dtype=float).flatten() # add intercept variable name ind_vars.insert(0, 'intercept')