CLIQUE<T>

Models & Types · AiDotNet.Clustering.Subspace

CLIQUE (CLustering In QUEst) subspace clustering algorithm.

Inheritance: ClusteringBase<T> → CLIQUE<T>

For Beginners

CLIQUE solves “the curse of dimensionality”:

Problem: In high-dimensional data, distances become meaningless, and traditional clustering fails.

Solution: Find clusters in subspaces (subsets of dimensions) where the data is actually clustered.

Example: In a 100-feature dataset, a cluster might only be visible when looking at features 3, 17, and 42 together.

CLIQUE automatically discovers these hidden subspaces!

How It Works

CLIQUE is a density-based, grid-based algorithm for finding subspace clusters. It automatically identifies the relevant subspaces where clusters exist.

Algorithm steps:

  1. Partition each dimension into equal-width intervals
  2. Find dense 1-D units (cells with points >= threshold)
  3. Use Apriori principle to find dense k-D units
  4. Merge connected dense units into clusters

Example

using AiDotNet;
using AiDotNet.Data.Loaders;
using AiDotNet.Clustering.Subspace;
using AiDotNet.Tensors.LinearAlgebra;

var data = new Matrix<double>(6, 2);
double[][] rows = { new[] { 1.0, 1.0 }, new[] { 1.2, 0.9 }, new[] { 1.1, 1.1 },
                    new[] { 8.0, 8.0 }, new[] { 8.2, 7.9 }, new[] { 7.9, 8.1 } };
for (int i = 0; i < 6; i++) { data[i, 0] = rows[i][0]; data[i, 1] = rows[i][1]; }

var result = await new AiModelBuilder<double, Matrix<double>, Vector<double>>()
    .ConfigureModel(new CLIQUE<double>())
    .ConfigureDataLoader(DataLoaders.FromMatrix(data))
    .BuildAsync();

var labels = result.Predict(data);
Console.WriteLine($"CLIQUE: clustered {labels.Length} points.");

Constructors

Constructor Summary
CLIQUE(CLIQUEOptions<T> options) Initializes a new CLIQUE instance.

Properties

Property Summary
IReadOnlyList<SubspaceCluster> SubspaceClusters { get; } Gets the discovered subspace clusters.

Methods

Method Summary
IFullModel<T, Matrix<T>, Vector<T>> WithParameters(Vector<T> parameters)
ModelOptions GetOptions()
Vector<T> Predict(Matrix<T> x)
void Train(Matrix<T> x, Vector<T> y)