neuralset.extractors.meta.ExtractorPCA

pydantic model neuralset.extractors.meta.ExtractorPCA[source][source]

Applies a PCA to another extractor’s data The underlying extractor is first computed through the prepare method, and then the current extractor applies the PCA on it. Both caches are stored.

Parameters:
  • extractor (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

Fields:
field extractor: BaseExtractor [Required][source]
field n_components: int [Required][source]
field whiten: bool = True[source]
field event_types: str | tuple[str, ...] = 'Event'[source]
field 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, slurm_setup=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')[source]
prepare(obj: Any) None[source][source]

Pre-compute and cache extractor data for a collection of events.

This method triggers _get_data on every matching event so that expensive computation (e.g. model inference) is done once and cached. It then calls the extractor on a single event to populate the output shape, which is needed when allow_missing=True.

Call prepare before using the extractor in a dataloader.

Parameters:

obj (DataFrame or sequence of Event or sequence of Segment) – The structure containing the events. When calling prepare on several objects, prefer passing a list of events or segments over a DataFrame to avoid redundant conversion overhead.

requirements: tp.ClassVar[tuple[str, ...]] = ()[source]