-
Notifications
You must be signed in to change notification settings - Fork 2
3. Multiple vigilance parameters
Jonas Schaub edited this page Nov 13, 2025
·
1 revision
The main parameter for ART-2a clustering is the vigilance parameter. To find the best-suited number of clusters for your input vectors, multiple vigilance parameters should be evaluated.
// Prepare your data as a 2D float array
// Each row represents a data vector
float[][] dataMatrix = {
{0.1f, 0.2f, 0.3f},
{0.2f, 0.1f, 0.4f},
{0.9f, 0.8f, 0.7f},
{0.8f, 0.9f, 0.6f},
{0.15f, 0.25f, 0.35f},
{0.85f, 0.75f, 0.65f},
{0.05f, 0.15f, 0.25f},
{0.95f, 0.85f, 0.75f},
{0.12f, 0.22f, 0.32f},
{0.88f, 0.78f, 0.68f}
};
// Configure clustering parameters
//*Multiple vigilance parameters in interval [0,1]*
float[] vigilances = {0.1f, 0.3f, 0.5f, 0.7f, 0.9f};
//Maximum number of clusters in interval [2, number of data row vectors of getDataMatrix]
int maximumNumberOfClusters = 10;
//default value
int maximumNumberOfEpochs = 10;
//default value
float convergenceThreshold = 0.99f;
//default value
float learningParameter = 0.01f;
//default value
float offsetForContrastEnhancement = 1.0f;
//default value
long randomSeed = 1L;
//do not preprocess data because it is already in range [0,1]
boolean isDataPreprocessing = false;
// Validate data matrix (same length in all rows, no empty rows, etc.)
if (Utils.isDataMatrixValid(dataMatrix)) {
// Create ART-2a kernel
Art2aKernel art2aKernel = new Art2aKernel(
dataMatrix,
maximumNumberOfClusters,
maximumNumberOfEpochs,
convergenceThreshold,
learningParameter,
offsetForContrastEnhancement,
randomSeed,
isDataPreprocessing
);
// Perform clustering with set vigilance parameters and do the determination
// of which cluster is closest to the new data point in parallel(!)
Art2aResult[] results = art2aKernel.getClusterResults(vigilances, true);
// Compare results
for (int i = 0; i < vigilances.length; i++) {
System.out.println("Vigilance " + vigilances[i] +
": " + results[i].getNumberOfDetectedClusters() + " clusters");
}
}
Output:
Vigilance 0.1: 2 clusters
Vigilance 0.3: 2 clusters
Vigilance 0.5: 2 clusters
Vigilance 0.7: 3 clusters
Vigilance 0.9: 5 clusters
Since most vigilances produce 2 clusters, this appears to be the best-suited result.