peal.teachers.spray_teacher.SprayConfig

class peal.teachers.spray_teacher.SprayConfig[source]

Bases: BaseModel

Config for the Spray teacher.

Parameters:
  • base_dir (str) – Directory the analysis (HDF5 databases, ViReLay project, labels) is written to.

  • data (DataConfig) – Dataset the classifier is analysed on; dataset_path/data.csv is re-written with a SprayLabel column.

  • dataset_name (str, optional) – Key into CLASS_NAMES; defaults to data.dataset_class.

  • model (str) – Path of the torch.load-able classifier.

  • port (int, optional) – Port of the ViReLay GUI. Default 8080.

  • use_relative_concept_importance (bool, optional) – Cluster CRP channel importances instead of raw attributions.

  • sum_attribution_channels (bool, optional) – Preprocessing steps applied before spectral clustering.

  • normalize_attribtions (bool, optional) – Preprocessing steps applied before spectral clustering.

  • attribution_layer (int, optional) – Index of the layer whose relevances are clustered; 0 means the input heatmaps. Default -2.

  • classes_total (int) – Number of classes to analyse.

  • num_clusters_max (int, optional) – k-means and agglomerative clusterings are run for k in 2..max.

  • num_eigval (int, optional) – Eigenvectors kept by the spectral embedding. Default 32.

  • tsne_perplexity (float/int or list) – One t-SNE and UMAP embedding is stored per value.

  • umap_neighbors (float/int or list) – One t-SNE and UMAP embedding is stored per value.

  • task (TaskConfig) – Task of the classifier, passed to get_datasets.

  • skip_wrongly_classified_samples (bool, optional) – Drop misclassified samples from the attribution database.

  • max_samples (int, optional) – Random subset size of the train split. Default 10000.

  • split_dataset (bool, optional) – Analyse train/val(/test) separately instead of concatenated.

  • conditioning_layer (optional) – Restrict CRP attribution to given channels of a layer.

  • conditioning_channels (optional) – Restrict CRP attribution to given channels of a layer.

  • include_testsplit (bool, optional) – Also include the test split in the analysis.

Methods

Attributes

config_name: str = 'SprayConfig'
base_dir: str
data: DataConfig
dataset_name: str = None
model: str
port: int = 8080
use_relative_concept_importance: bool = False
sum_attribution_channels: bool = False
normalize_attribtions: bool = True
attribution_layer: int = -2
classes_total: int
num_clusters_max: int = 8
num_eigval: int = 32
tsne_perplexity: float | list[float] = 64.0
umap_neighbors: int | list[int] = 32
task: TaskConfig
skip_wrongly_classified_samples: bool = False
max_samples: int = 10000
split_dataset: bool = False
conditioning_layer: int = None
conditioning_channels: list[int] = None
include_testsplit: bool = False