soft.fuzzy.unsupervised.granulation.online package

Submodules

soft.fuzzy.unsupervised.granulation.online.clip module

Implements the Categorical Learning Induced Partitioning (CLIP) algorithm.

soft.fuzzy.unsupervised.granulation.online.clip.apply_categorical_learning_induced_partitioning(dataset: SupervisedDataset, config: Config) LinguisticVariables

Categorical Learning Induced Partitioning (CLIP), is an unsupervised learning algorithm that produces and incrementally adjusts Gaussian fuzzy sets.

Parameters:
  • dataset – The dataset.

  • config – The configuration settings.

Returns:

A list of Gaussian fuzzy sets.

soft.fuzzy.unsupervised.granulation.online.clip.categorical_learning_induced_partitioning(tensor: Tensor, config: Config, minimums: Tensor, maximums: Tensor, terms: List[Gaussian] | None = None) List[Gaussian]

Categorical Learning Induced Partitioning (CLIP), is an unsupervised learning algorithm that produces and incrementally adjusts Gaussian fuzzy sets.

Parameters:
  • tensor – The selected tensor from the dataset.

  • config – The configuration settings.

  • minimums – The minimum value per feature in tensor.

  • maximums – The maximum value per feature in tensor.

  • terms – A list of terms to start from, if any.

Returns:

A list of Gaussian fuzzy sets along the tensor space.

soft.fuzzy.unsupervised.granulation.online.clip.center_and_sigma(terms, dim, term_idx)

Returns the center and sigma for the chosen linguistic term within the provided dimension, given an index.

Parameters:
  • terms (list) – A list of terms that have already been created that CLIP should consider when producing more terms. Default is None, which means no existing terms will be passed to CLIP.

  • dim (int) – The index of the dimension.

  • term_idx (int) – The index of the linguistic term.

Returns:

center (Torch.tensor), sigma (Torch.tensor)

soft.fuzzy.unsupervised.granulation.online.clip.find_indices_to_closest_neighbors(data_point, terms, dim)

For the given dimension (i.e., ‘dim’), calculates the distance between data_point[dim] and the existing linguistic terms that occupy said dimension. From there, it then determines which existing linguistic terms are to the left of data_point[dim], and which are to the right of data_point[dim]. If there are existing linguistic terms to the left of data_point[dim], the nearest one (w/ smallest distance to data_point[dim]) will have its index returned as ‘left_neighbor_idx’; else, ‘None’ will be returned in its place. If there are existing linguistic terms to the right of data_point[dim], the nearest one (w/ smallest distance to data_point[dim]) will have its index returned as ‘right_neighbor_idx’; else, ‘None’ will be returned in its place.

Parameters:
  • data_point (1D Numpy array) – A single input_data observation where each column is a feature/attribute.

  • terms (list) – A list of terms that have already been created that CLIP should consider when producing more terms. Default is None, which means no existing terms will be passed to CLIP.

  • dim (int) – The index of the current dimension.

Returns:

left_neighbor_idx (None if no left neighbor exists), right_neighbor_idx (None if no right neighbor exists)

soft.fuzzy.unsupervised.granulation.online.clip.make_first_fuzzy_sets(data_point, minimums, maximums, terms, alpha)

The first encountered observation is used to initialize a fuzzy set within each input dimension.

Parameters:
  • data_point (1D Numpy array) – A single input_data observation where each column is a feature/attribute.

  • minimums (iterable) – The minimum value per feature in X.

  • maximums (iterable) – The maximum value per feature in X.

  • terms (list) – A list of terms that have already been created that CLIP should consider when producing more terms. Default is None, which means no existing terms will be passed to CLIP.

  • alpha (float) – A hyperparameter to adjust the generated widths’ coverage.

Returns:

None

soft.fuzzy.unsupervised.granulation.online.clip.update_neighbor_sigma(data_point, terms, dim, neighbor_idx, alpha)

Given that we have identified a neighbor to a new fuzzy set that is being created, fetch its center and sigma values, and update its sigma values in response to the new fuzzy set. Does nothing and returns ‘None’ if the ‘neighbor_idx’ is ‘None’.

Parameters:
  • data_point (1D Numpy array) – A single input_data observation where each column is a feature/attribute.

  • terms (list) – A list of terms that have already been created that CLIP should consider when producing more terms. Default is None, which means no existing terms will be passed to CLIP.

  • dim (int) – The index of the current dimension.

  • neighbor_idx (int) – The index associated with this new fuzzy set’s neighbor; could be left or right neighbor.

  • alpha (float) – A hyperparameter to adjust the generated widths’ coverage.

Returns:

The new sigma for the newly created fuzzy set’s neighbor. Is ‘None’ if the given neighbor’s index is ‘None’. A neighbor_idx of ‘None’ means that the newly created fuzzy set has no neighbor on its (left/right) side.

Module contents