artlib.optimized.backends.torch.HypersphereARTMAP

Hypersphere ARTMAP (Torch-accelerated backend)

Classes

_TorchHypersphereARTMAPConfig

_TorchHypersphereARTMAP

GPU-accelerated Hypersphere ARTMAP with export hooks for artlib

HypersphereARTMAP

HypersphereARTMAP for Classification. optimized with torch.

Functions

_to_device(→ torch.Tensor)

Module Contents

artlib.optimized.backends.torch.HypersphereARTMAP._to_device(x: torch.Tensor | numpy.ndarray, device, dtype=torch.float32) torch.Tensor
class artlib.optimized.backends.torch.HypersphereARTMAP._TorchHypersphereARTMAPConfig
input_dim: int
alpha: float = 0.001
rho: float = 0.75
beta: float = 1.0
r_hat: float = 1.0
device: str = 'cuda'
dtype: torch.dtype = Ellipsis
clamp_inputs: bool = False
class artlib.optimized.backends.torch.HypersphereARTMAP._TorchHypersphereARTMAP(cfg: _TorchHypersphereARTMAPConfig)

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

GPU-accelerated Hypersphere ARTMAP with export hooks for artlib synchronization.

cfg
device
dtype
input_dim
weight_dim
W: torch.Tensor | None = None
map_y: torch.Tensor | None = None
_prep_tol: float = 1e-06
property n_cat: int
_ensure_capacity()
_prep_input(X: torch.Tensor) torch.Tensor
_validate_prepared(X: torch.Tensor)
_free_mem_bytes() int
_choice_and_match(I: torch.Tensor) Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]

Returns (T, m, I_radius, max_radius) for a single prepared input I.

_commit_new_category(I: torch.Tensor, y: int)

Start a new hypersphere at sample I with radius 0.

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]
predict_ab_prepared(X_prepared: torch.Tensor | numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray]
class artlib.optimized.backends.torch.HypersphereARTMAP.HypersphereARTMAP(rho: float, alpha: float, beta: float, r_hat: float, input_dim: int | None = None, device: str = 'cuda', dtype: torch.dtype = torch.float64, clamp_inputs: bool = False)

Bases: artlib.supervised.SimpleARTMAP.SimpleARTMAP

HypersphereARTMAP for Classification. optimized with torch.

This module implements HypersphereARTMAP

HypersphereARTMAP 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, HypersphereARTMAP behaves as a special case of SimpleARTMAP instantiated with HypersphereART.

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