peal.teachers.virelay_teacher¶
CFKD teacher that gathers human feedback through the ViReLay web GUI.
ViReLay (with CoRelAy for the spectral analysis) is a tool for browsing
attribution maps grouped by clusters. This teacher reuses it for counterfactual
feedback: for every counterfactual that flipped the student it computes a
per-channel relevance vector from the difference of an intermediate student
activation between factual and counterfactual, writes ViReLay’s HDF5 dataset,
attribution and analysis databases plus a project yaml into base_dir, serves
the project and waits for the user to save the selected (i.e. “false”) data
point indices as feedback.json. The helper functions and CoRelAy processors
in this module are adapted from the ViReLay example scripts.
Functions
Appends attributions to the attribution database file |
|
Creates an attribution database file |
|
Write a sequence of single attributions into a new attribution database. |
|
Creates a new dataset HDF5 file. |
|
Generates a ViRelAy project file. |
|
Performs a meta-analysis over the specified attribution data and writes the results into an analysis database. |
|
Serve a ViReLay project until the user has saved their feedback file. |
Classes
Represents a CoRelAy processor, which computes the absolute value of its input data. |
|
Represents a CoRelAy processor, which flattens its input data. |
|
Represents a CoRelAy processor, which computes a histogram over its input data. |
|
All images of one directory as RGB tensors with a dummy label of 0. |
|
Represents a CoRelAy processor, which normalizes its input data. |
|
Represents a CoRelAy processor, which sums its input data across channels, i.e., its second axis. |
|
Human teacher whose verdicts come from a ViReLay cluster selection. |