adds back alias for kmeans removed by accident

This commit is contained in:
Andy Eschbacher 2016-10-13 10:50:48 -04:00
parent 4314f0f066
commit a95423174c

View File

@ -9,7 +9,7 @@ def kmeans(query, no_clusters, no_init=20):
full_query = ''' full_query = '''
SELECT array_agg(cartodb_id ORDER BY cartodb_id) as ids, SELECT array_agg(cartodb_id ORDER BY cartodb_id) as ids,
array_agg(ST_X(the_geom) ORDER BY cartodb_id) xs, array_agg(ST_X(the_geom) ORDER BY cartodb_id) xs,
array_agg(ST_Y(the_geom) ORDER BY cartodb_id) array_agg(ST_Y(the_geom) ORDER BY cartodb_id) ys
FROM ({query}) As a FROM ({query}) As a
WHERE the_geom IS NOT NULL WHERE the_geom IS NOT NULL
'''.format(query=query) '''.format(query=query)
@ -87,8 +87,7 @@ def extract_columns(db_resp, id_col):
def scale_data(features): def scale_data(features):
""" """
Scale all input columns from 0 to 1 so that k-means puts them on equal Scale all input columns to center on 0 with a standard devation of 1
footing
input_data (numpy array): an array of dimension (n_features, n_samples) input_data (numpy array): an array of dimension (n_features, n_samples)
""" """
from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import StandardScaler