-
Notifications
You must be signed in to change notification settings - Fork 3
Encoding Layers
Script: tfsplt_encoding-layers.py
Makefile target: plot-encoding-layers
This is the plotting script for layer encoding results. It can plot different line colors, line styles, horizontal or vertical subplots. Given a datum, it also can plot averaged heatmaps (x is lags and y is layers), averaged scatter plot (x is layers and y is averaged max correlation), and scatter plot (x is lags and argmax per electrode, while y is layers)
For the layer plotting, you don't need to provide each layer in formats and labels. Instead, provide one format and a list of numbers inside labels. Notice how we have three %s in the format, corresponding to sid, labels, and keys respectively.
For color, provide a colormap to use. Default is 'viridis'.
Below is a full example of a Makefile target and its arguments. Here, we are plotting the whisper-medium.en encoding results for all layers of encoder. We split into subplots by keys (comprehension and production). Lines are colored by layers and styled by keys
# Arguments
LAGS_PLT := {-5000..5000..25} # lag10k-25
LAGS_SHOW := {-2000..2000..25}
X_VALS_SHOW := {-2000..2000..25}
LAG_TKS :=
LAG_TK_LABLS :=
Y_LIMIT := 0
FIG_SZ:= 18 6
SIG_FN_DIR := 'data/plotting/sig-elecs/20230413-whisper-paper'
SIG_FN := --sig-elec-file tfs-sig-file-%s-whisper-en-last-0.01-comp.csv tfs-sig-file-%s-whisper-en-last-0.01-prod.csv
plot-encoding-layers:
rm -f results/figures/*
python scripts/tfsplt_encoding-layers.py \
--sid 625 676 7170 798 \
--formats \
'/projects/HASSON/247/ken-encoding/demo/20230520-whisper-medium/kw-tfs-full-%s-whisper-medium.en-encoder-lag5k-25-all-%s/*/*_%s.csv' \
--labels $(shell seq 0 24) \
--colors viridis \
--keys comp prod \
--sig-elec-file-dir $(SIG_FN_DIR)\
$(SIG_FN) \
--fig-size $(FIG_SZ) \
--lags-plot $(LAGS_PLT) \
--lags-show $(LAGS_SHOW) \
--x-vals-show $(X_VALS_SHOW) \
$(LAG_TKS) \
$(LAG_TK_LABLS) \
--y-vals-limit $(Y_LIMIT) \
--outfile results/figures/tfs-whisper-encoder-layers-2s.pdf
rsync -av results/figures/ ~/tigress/247-encoding-results/