... | @@ -4,23 +4,25 @@ An implementation of several strategies for efficient k-means clustering. Given |
... | @@ -4,23 +4,25 @@ An implementation of several strategies for efficient k-means clustering. Given |
|
|
|
|
|
# Available Predicates
|
|
# Available Predicates
|
|
|
|
|
|
* [naiveKMeans/12](/PrologMethods/Clustering/kmeans#naivekmeans12)
|
|
* [naiveKMeans/9](/PrologMethods/Clustering/kmeans#naivekmeans9)
|
|
* [dualTreeKMeans/12](/PrologMethods/Clustering/kmeans#dualtreekmeans12)
|
|
* [dualTreeKMeans/9](/PrologMethods/Clustering/kmeans#dualtreekmeans9)
|
|
* [elkanKMeans/12](/PrologMethods/Clustering/kmeans#elkankmeans12)
|
|
* [elkanKMeans/9](/PrologMethods/Clustering/kmeans#elkankmeans9)
|
|
* [hamerlyKMeans/12](/PrologMethods/Clustering/kmeans#hamerlykmeans12)
|
|
* [hamerlyKMeans/9](/PrologMethods/Clustering/kmeans#hamerlykmeans12)
|
|
* [pellegMooreKMeans/12](/PrologMethods/Clustering/kmeans#pellegmoorekmeans12)
|
|
* [pellegMooreKMeans/9](/PrologMethods/Clustering/kmeans#pellegmoorekmeans9)
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
[links/resources](/PrologMethods/Clustering/kmeans#connected-linksresources)
|
|
[links/resources](/PrologMethods/Clustering/kmeans#connected-linksresources)
|
|
|
|
|
|
## **_naiveKMeans/12_**
|
|
## **_naiveKMeans/9_**
|
|
|
|
|
|
Runs kmeans with naive as the algorithm for the Lloyd iteration.
|
|
Runs kmeans with naive as the algorithm for the Lloyd iteration.
|
|
|
|
|
|
```prolog
|
|
```prolog
|
|
%% part of the predicate definition
|
|
%% part of the predicate definition
|
|
naiveKMeans( +integer, +integer, +integer,
|
|
naiveKMeans( +integer,
|
|
|
|
+string,
|
|
|
|
+string,
|
|
+pointer(float_array), +integer, +integer,
|
|
+pointer(float_array), +integer, +integer,
|
|
+integer,
|
|
+integer,
|
|
-pointer(float_array), -integer,
|
|
-pointer(float_array), -integer,
|
... | @@ -31,8 +33,8 @@ naiveKMeans( +integer, +integer, +integer, |
... | @@ -31,8 +33,8 @@ naiveKMeans( +integer, +integer, +integer, |
|
| Name | Type | Description | Default |
|
|
| Name | Type | Description | Default |
|
|
|------|------|-------------|---------|
|
|
|------|------|-------------|---------|
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "SampleInitialzation", "RandomPartition" | SampleInitialzation |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "sampleInitialization", "randomPartition" | sampleInitialzation |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster" | AllowEmptyCluster |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "maxVarianceNewCluster", "killEmptyCluster", "allowEmptyCluster" | allowEmptyCluster |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
... | @@ -40,13 +42,15 @@ naiveKMeans( +integer, +integer, +integer, |
... | @@ -40,13 +42,15 @@ naiveKMeans( +integer, +integer, +integer, |
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
## **_dualTreeKMeans/12_**
|
|
## **_dualTreeKMeans/9_**
|
|
|
|
|
|
Runs kmeans with dualtree as the algorithm for the Lloyd iteration.
|
|
Runs kmeans with dualtree as the algorithm for the Lloyd iteration.
|
|
|
|
|
|
```prolog
|
|
```prolog
|
|
%% part of the predicate definition
|
|
%% part of the predicate definition
|
|
dualTreeKMeans( +integer, +integer, +integer,
|
|
dualTreeKMeans( +integer,
|
|
|
|
+string,
|
|
|
|
+string,
|
|
+pointer(float_array), +integer, +integer,
|
|
+pointer(float_array), +integer, +integer,
|
|
+integer,
|
|
+integer,
|
|
-pointer(float_array), -integer,
|
|
-pointer(float_array), -integer,
|
... | @@ -57,8 +61,8 @@ dualTreeKMeans( +integer, +integer, +integer, |
... | @@ -57,8 +61,8 @@ dualTreeKMeans( +integer, +integer, +integer, |
|
| Name | Type | Description | Default |
|
|
| Name | Type | Description | Default |
|
|
|------|------|-------------|---------|
|
|
|------|------|-------------|---------|
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "SampleInitialzation", "RandomPartition" | SampleInitialzation |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "sampleInitialization", "randomPartition" | sampleInitialzation |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster" | AllowEmptyCluster |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "maxVarianceNewCluster", "killEmptyCluster", "allowEmptyCluster" | allowEmptyCluster |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
... | @@ -66,13 +70,15 @@ dualTreeKMeans( +integer, +integer, +integer, |
... | @@ -66,13 +70,15 @@ dualTreeKMeans( +integer, +integer, +integer, |
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
## **_elkanKMeans/12_**
|
|
## **_elkanKMeans/9_**
|
|
|
|
|
|
Runs kmeans with elkan as the algorithm for the Lloyd iteration.
|
|
Runs kmeans with elkan as the algorithm for the Lloyd iteration.
|
|
|
|
|
|
```prolog
|
|
```prolog
|
|
%% part of the predicate definition
|
|
%% part of the predicate definition
|
|
elkanKMeans( +integer, +integer, +integer,
|
|
elkanKMeans( +integer,
|
|
|
|
+string,
|
|
|
|
+string,
|
|
+pointer(float_array), +integer, +integer,
|
|
+pointer(float_array), +integer, +integer,
|
|
+integer,
|
|
+integer,
|
|
-pointer(float_array), -integer,
|
|
-pointer(float_array), -integer,
|
... | @@ -83,8 +89,8 @@ elkanKMeans( +integer, +integer, +integer, |
... | @@ -83,8 +89,8 @@ elkanKMeans( +integer, +integer, +integer, |
|
| Name | Type | Description | Default |
|
|
| Name | Type | Description | Default |
|
|
|------|------|-------------|---------|
|
|
|------|------|-------------|---------|
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "SampleInitialzation", "RandomPartition" | SampleInitialzation |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "sampleInitialization", "randomPartition" | sampleInitialzation |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster" | AllowEmptyCluster |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "maxVarianceNewCluster", "killEmptyCluster", "allowEmptyCluster" | allowEmptyCluster |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
... | @@ -92,13 +98,15 @@ elkanKMeans( +integer, +integer, +integer, |
... | @@ -92,13 +98,15 @@ elkanKMeans( +integer, +integer, +integer, |
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
## **_hamerlyKMeans/12_**
|
|
## **_hamerlyKMeans/9_**
|
|
|
|
|
|
Runs kmeans with hamerly as the algorithm for the Lloyd iteration.
|
|
Runs kmeans with hamerly as the algorithm for the Lloyd iteration.
|
|
|
|
|
|
```prolog
|
|
```prolog
|
|
%% part of the predicate definition
|
|
%% part of the predicate definition
|
|
hamerlyKMeans( +integer, +integer, +integer,
|
|
hamerlyKMeans( +integer,
|
|
|
|
+string,
|
|
|
|
+string,
|
|
+pointer(float_array), +integer, +integer,
|
|
+pointer(float_array), +integer, +integer,
|
|
+integer,
|
|
+integer,
|
|
-pointer(float_array), -integer,
|
|
-pointer(float_array), -integer,
|
... | @@ -109,8 +117,8 @@ hamerlyKMeans( +integer, +integer, +integer, |
... | @@ -109,8 +117,8 @@ hamerlyKMeans( +integer, +integer, +integer, |
|
| Name | Type | Description | Default |
|
|
| Name | Type | Description | Default |
|
|
|------|------|-------------|---------|
|
|
|------|------|-------------|---------|
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "SampleInitialzation", "RandomPartition" | SampleInitialzation |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "sampleInitialization", "randomPartition" | sampleInitialzation |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster" | AllowEmptyCluster |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "maxVarianceNewCluster", "killEmptyCluster", "allowEmptyCluster" | allowEmptyCluster |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
... | @@ -118,13 +126,15 @@ hamerlyKMeans( +integer, +integer, +integer, |
... | @@ -118,13 +126,15 @@ hamerlyKMeans( +integer, +integer, +integer, |
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|
## **_pellegMooreKMeans/12\]_**
|
|
## **_pellegMooreKMeans/9_**
|
|
|
|
|
|
Runs kmeans with pelleg morre as the algorithm for the Lloyd iteration.
|
|
Runs kmeans with pelleg morre as the algorithm for the Lloyd iteration.
|
|
|
|
|
|
```prolog
|
|
```prolog
|
|
%% part of the predicate definition
|
|
%% part of the predicate definition
|
|
pellegMooreKMeans( +integer, +integer, +integer,
|
|
pellegMooreKMeans( +integer,
|
|
|
|
+string,
|
|
|
|
+string,
|
|
+pointer(float_array), +integer, +integer,
|
|
+pointer(float_array), +integer, +integer,
|
|
+integer,
|
|
+integer,
|
|
-pointer(float_array), -integer,
|
|
-pointer(float_array), -integer,
|
... | @@ -135,8 +145,8 @@ pellegMooreKMeans( +integer, +integer, +integer, |
... | @@ -135,8 +145,8 @@ pellegMooreKMeans( +integer, +integer, +integer, |
|
| Name | Type | Description | Default |
|
|
| Name | Type | Description | Default |
|
|
|------|------|-------------|---------|
|
|
|------|------|-------------|---------|
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| maxIterations | +integer | Maximum number of iterations before k-means terminates. | 1000 |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "SampleInitialzation", "RandomPartition" | SampleInitialzation |
|
|
| initialPartition | +string | Sets the initialPartitionPolicy : "sampleInitialization", "randomPartition" | sampleInitialzation |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "MaxVarianceNewCluster", "KillEmptyCluster", "AllowEmptyCluster" | AllowEmptyCluster |
|
|
| emptyCluster | +string | Sets the emptyClusterPolicy: "maxVarianceNewCluster", "killEmptyCluster", "allowEmptyCluster" | allowEmptyCluster |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| data | +matrix | Input dataset to perform clustering on. | - |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| clusters | +integer | Number of clusters to find (0 autodetects from initial centroids). | 0 |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
|
| assignments | -vector | Vector to store cluster assignments in. | - |
|
... | | ... | |