artlib.fusion.FusionART
Fusion ART [15].
Classes
Fusion ART for Data Fusion and Regression. |
Functions
|
Generate the start and end positions for each channel in the input data. |
Module Contents
- artlib.fusion.FusionART.get_channel_position_tuples(channel_dims: List[int]) List[Tuple[int, int]]
Generate the start and end positions for each channel in the input data.
- class artlib.fusion.FusionART.FusionART(modules: List[artlib.common.BaseART.BaseART], gamma_values: List[float] | numpy.ndarray, channel_dims: List[int] | numpy.ndarray)
Bases:
artlib.common.BaseART.BaseARTFusion ART for Data Fusion and Regression.
This module implements Fusion ART as first described in: [15].
Fusion ART accepts an arbitrary number of ART modules, each assigned a different data channel. The activation and match functions for all ART modules are then fused such that all modules must be simultaneously active and resonant in order for a match to occur. This provides fine-grain control when clustering multi-channel or multi-modal data and allows for different geometries of clusters to be used for each channel. Fusion ART also allows for fitting regression models and specific functions have been implemented to allow this.
- modules
- n
- channel_dims
- _channel_indices = []
- dim_
- property n_clusters: int
Return the number of clusters in the first ART module.
- Returns:
The number of clusters.
- Return type:
- property W
Get the weights of all modules as a single array.
- Returns:
Concatenated weights of all channels from the ART modules.
- Return type:
- static validate_params(params: Dict)
Validate clustering parameters.
- Parameters:
params (dict) – The parameters for the FusionART model.
- validate_data(X: numpy.ndarray)
Validate the input data for clustering.
- Parameters:
X (np.ndarray) – The input dataset.
- check_dimensions(X: numpy.ndarray)
Ensure that the input data has the correct dimensions.
- Parameters:
X (np.ndarray) – The input dataset.
- prepare_data(channel_data: List[numpy.ndarray], skip_channels: List[int] = []) numpy.ndarray
Prepare the input data by processing each channel’s data through its respective ART module.
- restore_data(X: numpy.ndarray, skip_channels: List[int] = []) List[numpy.ndarray]
Restore data to its original state before preparation.
- category_choice(i: numpy.ndarray, w: list, params: Dict, skip_channels: List[int] = []) Tuple[float, Dict | None]
Get the activation of the cluster.
- Parameters:
- Returns:
Cluster activation and cache for further processing.
- Return type:
- match_criterion(i: numpy.ndarray, w: list, params: Dict, cache: Dict | None = None, skip_channels: List[int] = []) Tuple[float, Dict | None]
Get the match criterion for the cluster.
- Parameters:
- Returns:
max match_criterion across channels and the updated cache.
- Return type:
- match_criterion_bin(i: numpy.ndarray, w: list, params: Dict, cache: Dict | None = None, op: Callable = operator.ge, skip_channels: List[int] = []) Tuple[bool, Dict]
Get the binary match criterion for the cluster.
- Parameters:
i (np.ndarray) – The data sample.
w (np.ndarray) – The cluster weight information.
params (dict) – Parameters for the ART algorithm.
cache (dict, optional) – Cache for previous calculations (default is None).
op (Callable, optional) – Operator for comparison (default is operator.ge).
skip_channels (list of int, optional) – Channels to be skipped (default is []).
- Returns:
Binary match criterion and cache for further processing.
- Return type:
- _match_tracking(cache: List[Dict] | Dict, epsilon: float, params: List[Dict] | Dict, method: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~']) bool
Perform match tracking for all channels using the specified method.
- Parameters:
- Returns:
Whether to continue searching for a match across all channels.
- Return type:
- _set_params(new_params: Dict)
Set the parameters for each module in FusionART.
- _deep_copy_params() Dict
Create a deep copy of the parameters for each module.
- Returns:
A dictionary with module indices as keys and their deep-copied parameters as values.
- Return type:
- step_fit(x: numpy.ndarray, match_reset_func: Callable | None = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0) int
Fit the model to a single sample.
- Parameters:
x (np.ndarray) – Data sample.
match_reset_func (callable, optional) – A callable that influences cluster creation.
match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, default="MT+") – Method for resetting match criterion.
epsilon (float, default=0.0) – Epsilon value used for adjusting match criterion.
- Returns:
Cluster label of the input sample.
- Return type:
- partial_fit(X: numpy.ndarray, match_reset_func: Callable | None = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0)
Iteratively fit the model to the data.
- Parameters:
X (np.ndarray) – Input dataset.
match_reset_func (callable, optional) – Function to reset the match criteria based on external factors.
match_tracking (Literal["MT+", "MT-", "MT0", "MT1", "MT~"], optional) – Method for resetting match criteria (default is “MT+”).
epsilon (float, optional) – Value to adjust the vigilance parameter (default is 0.0).
- predict(X: numpy.ndarray, clip: bool = False, skip_channels: List[int] = []) numpy.ndarray
Predict labels for the input data.
- update(i: numpy.ndarray, w: list, params: Dict, cache: Dict | None = None) list
Update the cluster weight.
- set_weight(idx: int, new_w: list)
Set the value of a cluster weight.
Parameters: - idx: index of cluster to update - new_w: new cluster weight
- get_cluster_centers() List[numpy.ndarray]
Get the center points for each cluster.
- Returns:
Center points of the clusters.
- Return type:
list of np.ndarray
- get_channel_centers(channel: int) List[numpy.ndarray]
Get the center points of clusters for a specific channel.
- predict_regression(X: numpy.ndarray, clip: bool = False, target_channels: List[int] = [-1]) numpy.ndarray | List[numpy.ndarray]
Predict regression values for the input data using the target channels.
- Parameters:
X (np.ndarray) – Input dataset.
clip (bool) – clip the input values to be between the previously seen data limits
target_channels (list of int, optional) – List of target channels to use for regression. If negative values are used, they are considered as channels counting backward from the last channel. By default, it uses the last channel (-1).
- Returns:
Predicted regression values. If only one target channel is used, returns a single np.ndarray. If multiple target channels are used, returns a list of np.ndarray, one for each channel.
- Return type:
Union[np.ndarray, list of np.ndarray]
- join_channel_data(channel_data: List[numpy.ndarray], skip_channels: List[int] = []) numpy.ndarray
Concatenate data from different channels into a single array.