InputTable
DROP TABLE input_table_udt;
CREATE MULTISET TABLE input_table_udt(id INTEGER, array_col Vector) PRIMARY INDEX ( id );
INSERT INTO input_table_udt values(1, '1, 1');
INSERT INTO input_table_udt values(2, '2, 2');
INSERT INTO input_table_udt values(3, '8, 8');
INSERT INTO input_table_udt values(4, '9, 9');
id |
array_col |
1 |
1.000000000000000,1.000000000000000 |
2 |
2.000000000000000,2.000000000000000 |
3 |
8.000000000000000,8.000000000000000 |
4 |
9.000000000000000,9.000000000000000 |
IntialCentroidsTable
DROP TABLE initial_centroids_table_udt;
CREATE MULTISET TABLE initial_centroids_table_udt as (SELECT * FROM input_table_udt where id in (2,4)) with data;
id |
array_col |
2 |
2.000000000000000,2.000000000000000 |
4 |
9.000000000000000,9.000000000000000 |
Example: TD_KMeans SQL Call: InitialCentroidsTable not provided
SELECT * FROM TD_KMeans (
ON input_table_udt as InputTable
USING
IdColumn('id')
TargetColumns('array_col')
NumClusters(2)
Seed(0)
StopThreshold(0.0395)
MaxIterNum(3)
EmbeddingSize(2)
)as dt;
Output: InitialCentroidsTable not provided
td_clusterid_kmeans |
array_col |
td_size_kmeans |
td_withinss_kmeans |
id |
td_modelinfo_kmeans |
0 |
1.500000000000000,1.500000000000000 |
2 |
1.000000000000000E 000 |
NULL |
NULL |
1 |
8.500000000000000,8.500000000000000 |
2 |
1.000000000000000E 000 |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
Converged: true |
NULL |
NULL |
NULL |
NULL |
NULL |
Number of Iterations: 2 |
NULL |
NULL |
NULL |
NULL |
NULL |
Number of Clusters: 2 |
NULL |
NULL |
NULL |
NULL |
NULL |
Total_WithinSS : 2.00000000000000E+00 |
NULL |
NULL |
NULL |
NULL |
NULL |
Between_SS : 9.80000000000000E+01 |
NULL |
NULL |
NULL |
NULL |
NULL |
Method for InitialCentroids: Random |
Example: TD_KMeans SQL Call: InitialCentroidsTable is provided
SELECT * FROM TD_KMeans (
ON input_table_udt as InputTable
ON initial_centroids_table_udt as InitialCentroidsTable DIMENSION
USING
IdColumn('id')
TargetColumns('array_col')
StopThreshold(0.0395)
MaxIterNum(3)
EmbeddingSize(2)
)as dt;
Output: InitialCentroidsTable is provided
td_clusterid_kmeans |
array_col |
td_size_kmeans |
td_withinss_kmeans |
id |
td_modelinfo_kmeans |
0 |
1.500000000000000,1.500000000000000 |
2 |
1.000000000000000E 000 |
NULL |
NULL |
1 |
8.500000000000000,8.500000000000000 |
2 |
1.000000000000000E 000 |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
NULL |
Converged: true |
NULL |
NULL |
NULL |
NULL |
NULL |
Number of Iterations: 2 |
NULL |
NULL |
NULL |
NULL |
NULL |
Number of Clusters: 2 |
NULL |
NULL |
NULL |
NULL |
NULL |
Total_WithinSS : 2.00000000000000E+00 |
NULL |
NULL |
NULL |
NULL |
NULL |
Between_SS : 9.80000000000000E+01 |
NULL |
NULL |
NULL |
NULL |
NULL |
Method for InitialCentroids: Externally supplied InitialCentroidsTable |