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, '-0.06944,0.080352,0.045963,0.006985,-0.000496');
INSERT INTO input_table_udt values(2, '-0.025461,0.045302,-0.028107,0.031248,0.00077');
INSERT INTO input_table_udt values(3, '-0.028107,0.016781,-0.023147,-0.068779,-0.07936');
INSERT INTO input_table_udt values(4, '-0.030091,0.027611,-0.047616,-0.025461,0.029595');
| id |
array_col |
| 1 |
-0.06944,0.080352,0.045963,0.006985,-0.000496 |
| 2 |
-0.025461,0.045302,-0.028107,0.031248,0.00077 |
| 3 |
-0.028107,0.016781,-0.023147,-0.068779,-0.07936 |
| 4 |
-0.030091,0.027611,-0.047616,-0.025461,0.029595 |
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 |
-0.025461,0.045302,-0.028107,0.031248,0.00077 |
| 4 |
-0.030091,0.027611,-0.047616,-0.025461,0.029595 |
Example: TD_KMeans SQL Call: InitialCentroidsTable not provided
SELECT td_clusterid_kmeans, cast(array_col as Varchar(100)) as array_col, td_size_kmeans, td_withinss_kmeans, id, td_modelinfo_kmeans
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(5)
)as dt;
Output: InitialCentroidsTable not provided
| td_clusterid_kmeans |
array_col |
td_size_kmeans |
td_withinss_kmeans |
id |
td_modelinfo_kmeans |
| 0 |
-0.06944,0.080352,0.045963,0.006985,-0.000496 |
1 |
0.00000000000000E 000 |
NULL |
NULL |
| 1 |
-0.0278863333333333,0.029898,-0.0329566666666667,-0.0209973333333333,-0.0163316666666667 |
3 |
1.21668890066667E-002 |
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 : 1.21668890066667E-02 |
| NULL |
NULL |
NULL |
NULL |
NULL |
Between_SS : 8.65080482533333E-03 |
| NULL |
NULL |
NULL |
NULL |
NULL |
Method for InitialCentroids: Random |
Example: TD_KMeans SQL Call: InitialCentroidsTable is provided
SELECT td_clusterid_kmeans, cast(array_col as Varchar(100)) as array_col, td_size_kmeans, td_withinss_kmeans, id, td_modelinfo_kmeans 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(5)
)as dt;
Output: InitialCentroidsTable is provided
| td_clusterid_kmeans |
array_col |
td_size_kmeans |
td_withinss_kmeans |
id |
td_modelinfo_kmeans |
| 0 |
-0.0474505,0.062827,0.008928,0.0191165,0.000137 |
2 |
4.61965788300000E-003 |
NULL |
NULL |
| 1 |
-0.029099,0.022196,-0.0353815,-0.04712,-0.0248825 |
2 |
7.23379913300000E-003 |
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 : 1.18534570160000E-02 |
| NULL |
NULL |
NULL |
NULL |
NULL |
Between_SS : 8.96423681600000E-03 |
| NULL |
NULL |
NULL |
NULL |
NULL |
Method for InitialCentroids: Externally supplied InitialCentroidsTable |