adds missing arguments
This commit is contained in:
parent
4389c9538d
commit
a188b2e104
@ -11,12 +11,18 @@ $$ LANGUAGE plpythonu;
|
|||||||
-- Non-spatial k-means clustering
|
-- Non-spatial k-means clustering
|
||||||
-- query: sql query to retrieve all the needed data
|
-- 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 $$
|
RETURNS TABLE(cluster_label text, cluster_center text, rowid bigint) AS $$
|
||||||
|
|
||||||
from crankshaft.clustering import kmeans_nonspatial
|
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;
|
$$ LANGUAGE plpythonu;
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ def kmeans_nonspatial(query, colnames, num_clusters=5,
|
|||||||
cluster_columns = _scale_data(
|
cluster_columns = _scale_data(
|
||||||
_extract_columns(db_resp, id_col=out_id_colname))
|
_extract_columns(db_resp, id_col=out_id_colname))
|
||||||
else:
|
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
|
# TODO: decide on optimal parameters for most cases
|
||||||
# Are there ways of deciding parameters based on inputs?
|
# Are there ways of deciding parameters based on inputs?
|
||||||
|
Loading…
Reference in New Issue
Block a user