soft.fuzzy.unsupervised.cluster.offline package

Submodules

soft.fuzzy.unsupervised.cluster.offline.empirical module

Implements the empirical fuzzy sets algorithm.

class soft.fuzzy.unsupervised.cluster.offline.empirical.MultimodalDensity(uniques, frequencies, distances, densities)

Bases: tuple

densities

Alias for field number 3

distances

Alias for field number 2

frequencies

Alias for field number 1

uniques

Alias for field number 0

soft.fuzzy.unsupervised.cluster.offline.empirical.find_data_clouds(cloud_centers, cloud_distances, cloud_widths, distance_threshold, prototypes)

Note: This code needs to be analyzed and its purpose should be better documented.

Parameters:
  • cloud_centers

  • cloud_distances

  • cloud_widths

  • distance_threshold

  • prototypes

Returns:

soft.fuzzy.unsupervised.cluster.offline.empirical.find_empirical_fuzzy_sets(input_data: Tensor)

Discover empirical fuzzy sets.

Parameters:

input_data – Multivariate input data, PyTorch tensor.

Returns:

The final partitions (Empirical Fuzzy Sets), soft.fuzzy.sets.Base.

soft.fuzzy.unsupervised.cluster.offline.empirical.find_local_maxima(results: namedtuple)

Prepares the results from the multimodal density calculations for the identification of the local maxima.

Parameters:

results – A namedtuple, MultimodalDensity, with attributes: uniques, frequencies, distances, densities.

Returns:

The multimodal densities, after being sorted by a special distance heuristic.

soft.fuzzy.unsupervised.cluster.offline.empirical.memory_efficient_distance_matrix(vector: Tensor, other_vector: Tensor) Tensor

A memory efficient distance matrix calculation that can substitute PyTorch’s torch.cdist().

https://discuss.pytorch.org/t/efficient-distance-matrix-computation/9065/4

Parameters:
  • vector – A vector.

  • other_vector – Some other vector.

Returns:

The distance matrix between ‘vector’ and ‘other_vector’.

soft.fuzzy.unsupervised.cluster.offline.empirical.multimodal_density(input_data: Tensor)

Calculates the multimodal density of the multivariate input data.

Parameters:

input_data – Multivariate input data, PyTorch tensor.

Returns:

uniques, frequencies, distances, densities.

The uniques field contains only the unique observations from input_data, the frequencies describes how often each unique observation occurs in input_data, the distances is a matrix showing the distances between each unique observation (as seen in uniques), and the densities attribute is the calculated density for each unique observation.

Return type:

A namedtuple, MultimodalDensity, with attributes

soft.fuzzy.unsupervised.cluster.offline.empirical.reduce_partitioning(results, prototypes) Gaussian

Reduce the number of identified prototypes by only keeping those that strongly envelop their nearby prototypes.

Parameters:
  • results – A namedtuple, MultimodalDensity, with attributes: uniques, frequencies, distances, densities.

  • prototypes – The prototypes that are identified in the first iteration of the Empirical Fuzzy Sets algorithm.

Returns:

The final partitions, soft.fuzzy.sets.Base.

soft.fuzzy.unsupervised.cluster.offline.empirical.select_prototypes(results, local_maxima)

Selects the prototypes that are identified in the first iteration of the Empirical Fuzzy Sets algorithm by only considering the local maximum criteria.

Parameters:
  • results – A namedtuple, MultimodalDensity, with attributes: uniques, frequencies, distances, densities.

  • local_maxima – The multimodal densities, after being sorted by a special distance heuristic.

Returns:

The prototypes that are identified in the first iteration of the Empirical Fuzzy Sets algorithm.

Module contents