artlib.optimized.backends.torch.FuzzyARTMAP

Fuzzy ARTMAP [8].

Classes

_TorchFuzzyARTMAPConfig

_TorchFuzzyARTMAP

Torch accelerated Fuzzy ARTMAP with export hooks for artlib synchronization.

FuzzyARTMAP

FuzzyARTMAP for Classification. optimized with torch.

Functions

_to_device(→ torch.Tensor)

_complement_code(→ torch.Tensor)

Module Contents

artlib.optimized.backends.torch.FuzzyARTMAP._to_device(x: torch.Tensor | numpy.ndarray, device, dtype=torch.float32) torch.Tensor
artlib.optimized.backends.torch.FuzzyARTMAP._complement_code(x: torch.Tensor) torch.Tensor
class artlib.optimized.backends.torch.FuzzyARTMAP._TorchFuzzyARTMAPConfig
input_dim: int
alpha: float = 0.001
rho: float = 0.75
beta: float = 1.0
epsilon: float = 1e-07
match_tracking: bool = True
device: str = 'cuda'
dtype: torch.dtype = Ellipsis
clamp_inputs: bool = True
fallback_to_choice_on_fail: bool = True
class artlib.optimized.backends.torch.FuzzyARTMAP._TorchFuzzyARTMAP(cfg: _TorchFuzzyARTMAPConfig)

Torch accelerated Fuzzy ARTMAP with export hooks for artlib synchronization.

cfg
device
dtype
input_dim
code_dim
W: torch.Tensor | None = None
map_y: torch.Tensor | None = None
_lower_bounds: torch.Tensor | None = None
_upper_bounds: torch.Tensor | None = None
_prep_tol: float = 1e-06
property n_cat: int
_ensure_capacity()
_validate_prepared(X: torch.Tensor)
_free_mem_bytes() int
set_data_bounds(lower: torch.Tensor | numpy.ndarray, upper: torch.Tensor | numpy.ndarray)
prepare_data(X: torch.Tensor | numpy.ndarray) torch.Tensor
_choice_and_match(I: torch.Tensor) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]

Returns (T, m, I_sum, IandW_sum) for a single prepared input I.

_commit_new_category(I: torch.Tensor, y: int)
partial_fit_and_export(X_prepared: torch.Tensor | numpy.ndarray, y: torch.Tensor | numpy.ndarray, epsilon: float = 1e-10, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+') Tuple[numpy.ndarray, list[numpy.ndarray], numpy.ndarray]

Incremental training on already-prepared inputs.

Returns: labels_a_out (np.ndarray): per-sample chosen A-side category indices weights_arrays (list[np.ndarray]): per-category weights (float64) cluster_labels_out (np.ndarray): map from A categories to B labels

predict_ab_prepared(X_prepared: torch.Tensor | numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray]
class artlib.optimized.backends.torch.FuzzyARTMAP.FuzzyARTMAP(rho: float, alpha: float, beta: float, input_dim: int | None = None, device: str = 'cuda', dtype: torch.dtype = torch.float64)

Bases: artlib.optimized.backends.torch._TorchSimpleARTMAP._TorchSimpleARTMAP

FuzzyARTMAP for Classification. optimized with torch.

This module implements FuzzyARTMAP

FuzzyARTMAP is a non-modular classification model which has been highly optimized for run-time performance. Fit and predict functions are implemented in torch for efficient execution. This class acts as a wrapper for the underlying torch functions and to provide compatibility with the artlib style and usage. Functionally, FuzzyARTMAP behaves as a special case of SimpleARTMAP instantiated with FuzzyART.

_device = 'cuda'
_dtype = Ellipsis
_backend: _TorchFuzzyARTMAP | None = None
_declared_input_dim = None
_ensure_backend(X: numpy.ndarray)