neuralset.extractors.meta.HuggingFacePCA¶
- class neuralset.extractors.meta.HuggingFacePCA(*, event_types: str | tuple[str, ...] = 'Event', aggregation: Literal['single', 'sum', 'mean', 'first', 'middle', 'last', 'cat', 'stack', 'trigger'] = 'single', allow_missing: bool = False, frequency: float = 0.0, extractor: BaseExtractor, n_components: int, whiten: bool = True, infra: MapInfra = MapInfra(folder=None, cluster=None, logs='{folder}/logs/{user}/%j', job_name=None, timeout_min=None, nodes=1, tasks_per_node=1, cpus_per_task=None, gpus_per_node=None, mem_gb=None, max_pickle_size_gb=None, slurm_constraint=None, slurm_partition=None, slurm_account=None, slurm_qos=None, slurm_use_srun=False, slurm_additional_parameters=None, conda_env=None, workdir=None, permissions=511, version='0', keep_in_ram=True, max_jobs=128, min_samples_per_job=1, forbid_single_item_computation=False, mode='cached'), use_tmp_cache: bool = True)[source][source]¶
Applies a PCA to the underlying HuggingFace extractor. The underlying extractor is first computed through the prepare method, and then the current extractor applies the PCA on it. Compared to the ExtractorPCA extractor, HuggingFacePCA handles caching of multiple layers at once in the cache. By default, the hugging face extractor cache is deleted afterwards.
- Parameters:
extractor (HuggingFace Extractor) – the underlying extractor on which the PCA must be applied
n_components (int) – the number of components of the PCA
whiten (bool) – whether the whiten post PCA
use_tmp_cache (bool) – whether to use a temporary cache folder for the underlying extractor that gets deleted afterwards