adds missing arguments

This commit is contained in:
Andy Eschbacher 2016-10-21 15:51:54 -06:00
parent 4389c9538d
commit a188b2e104
2 changed files with 11 additions and 5 deletions

View File

@ -11,12 +11,18 @@ $$ LANGUAGE plpythonu;
-- Non-spatial k-means clustering
-- query: sql query to retrieve all the needed data
CREATE OR REPLACE FUNCTION CDB_KMeansNonspatial(query TEXT, colnames TEXT[], num_clusters INTEGER, id_col TEXT DEFAULT 'cartodb_id')
CREATE OR REPLACE FUNCTION CDB_KMeansNonspatial(
query TEXT,
colnames TEXT[],
num_clusters INTEGER,
id_col TEXT DEFAULT 'cartodb_id',
standarize BOOLEAN DEFAULT true
)
RETURNS TABLE(cluster_label text, cluster_center text, rowid bigint) AS $$
from crankshaft.clustering import kmeans_nonspatial
return kmeans_nonspatial(query, colnames, num_clusters, id_col)
return kmeans_nonspatial(query, colnames, num_clusters,
id_col, standarize)
$$ LANGUAGE plpythonu;

View File

@ -62,7 +62,7 @@ def kmeans_nonspatial(query, colnames, num_clusters=5,
cluster_columns = _scale_data(
_extract_columns(db_resp, id_col=out_id_colname))
else:
cluster_columns = _extract_columns(db_resp)
cluster_columns = _extract_columns(db_resp, id_col=out_id_colname)
# TODO: decide on optimal parameters for most cases
# Are there ways of deciding parameters based on inputs?