Welcome to torchcluster’s documentation!

class torchcluster.dataset.SimpleDataset(n_clusters, device='cpu', feature=10, sigma=10)[source]

We use this as a simple dataset to test clustering algorithm.

Simple dataset factory’s config.

Args:
n_clusters (int) - How many clusters in result.
Kwargs:

device (string) - Device of tensors.

feature (int) - The dim of each data point.

sigma (float) - Factor of clustering difficulty, the bigger the easier.

__call__(n)[source]

Generate dataset.

Args:
n (int) - the number of data point.
class torchcluster.zoo.KMeans(n_clusters, tol=0.0001)[source]

K-Means algorithm

Spectrum clustering factory’s config.

Args:
n_clusters (int) - How many clusters in result.
Kwargs:
tol (float) - stop to update when shift is smaller than tol
__call__(x)[source]

Clustering.

Args:
x (Tensor) - Data points of number n by feature dim m.
class torchcluster.zoo.SpectrumClustering(n_clusters=None, cluster=None, threshold=2, k=2, eps=1e-05)[source]

Spectrum clustering algorithm.

Spectrum clustering factory’s config.

Kwargs:

n_clusters (int) - how many clusters in result. You do not need it if giving a cluster

cluster (Cluster) - clustering method after spectrum transformation

threshold (int) - threshold of dropping out an edge

k (int) - the number of selected feature

eps (float) – a value added to the denominator for numerical stability.

__call__(x)[source]

Clustering.

Args:
x (Tensor) - Data points of number n by feature dim m.

Indices and tables