Aggregate K-means

This endpoint runs the k-means algorithm - a heuristic algorithm that attempts to do k-means clustering. An ideal k-means clustering algorithm selects k points such that the sum of the mean squared distances of each member of the set to the nearest of the k points is minimized. The k-means algorithm however does not necessarily produce such an ideal cluster. It begins with a randomly selected set of k points and then refines the location of the points iteratively and settles to a local minimum. Various parameters and options are provided to control the heuristic search.

NOTE: The Kinetica instance being accessed must be running a CUDA (GPU-based) build to service this request.

Input Parameter Description

NameTypeDescription
table_namestringName of the table on which the operation will be performed. Must be an existing table, in [schema_name.]table_name format, using standard name resolution rules.
column_namesarray of stringsList of column names on which the operation would be performed. If n columns are provided then each of the k result points will have n dimensions corresponding to the n columns.
kintThe number of mean points to be determined by the algorithm.
tolerancedoubleStop iterating when the distances between successive points is less than the given tolerance.
optionsmap of string to strings

Optional parameters. The default value is an empty map ( {} ).

Supported Parameters (keys)Parameter Description
whitenWhen set to 1 each of the columns is first normalized by its stdv - default is not to whiten.
max_itersNumber of times to try to hit the tolerance limit before giving up - default is 10.
num_triesNumber of times to run the k-means algorithm with a different randomly selected starting points - helps avoid local minimum. Default is 1.
create_temp_table

If true, a unique temporary table name will be generated in the sys_temp schema and used in place of result_table. If result_table_persist is false (or unspecified), then this is always allowed even if the caller does not have permission to create tables. The generated name is returned in qualified_result_table_name. The default value is false. The supported values are:

  • true
  • false
result_tableThe name of a table used to store the results, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. If this option is specified, the results are not returned in the response.
result_table_persist

If true, then the result table specified in result_table will be persisted and will not expire unless a ttl is specified. If false, then the result table will be an in-memory table and will expire unless a ttl is specified otherwise. The default value is false. The supported values are:

  • true
  • false
ttlSets the TTL of the table specified in result_table.

Output Parameter Description

NameTypeDescription
meansarray of arrays of doublesThe k-mean values found.
countsarray of longsThe number of elements in the cluster closest the corresponding k-means values.
rms_distsarray of doublesThe root mean squared distance of the elements in the cluster for each of the k-means values.
countlongThe total count of all the clusters - will be the size of the input table.
rms_distdoubleThe sum of all the rms_dists - the value the k-means algorithm is attempting to minimize.
tolerancedoubleThe distance between the last two iterations of the algorithm before it quit.
num_itersintThe number of iterations the algorithm executed before it quit.
infomap of string to strings

Additional information. The default value is an empty map ( {} ).

Possible Parameters (keys)Parameter Description
qualified_result_table_nameThe fully qualified name of the result table (i.e. including the schema) used to store the results.