Heatmaps

This module is to create heatmaps for given books. It even includes some functions to generate smaller heatmaps

Methods of pkl files


source

heatmap_from_pkl

 heatmap_from_pkl (path:str='.', min_labels:bool=False, std:bool=False,
                   corr:bool=False)

Plot timeseries from the pkl file

Type Default Details
path str . path to pkl files
min_labels bool False flag to use shorter labels
std bool False flag to standardize
corr bool False flag to save corr plot
Returns None
heatmap_from_pkl(path = 'embeddings/A_Modest_Proposal/pkl', 
                min_labels=True,
                std = True,
                corr=True)
Current path /home/deven/embeddings/A_Modest_Proposal/pkl
Found 1 pkl files
---------------------------------------------
A Modest Proposal
---------------------------------------------
<Figure size 432x288 with 0 Axes>

Methods of SSMs


source

plot_novels

 plot_novels (path:str=None, start:int=0, end:int=-1, x:bool=False,
              y:int=5, std:bool=False)

Generates plots for embeddings in the folder

Type Default Details
path str None path for embeddings
start int 0 start for section
end int -1 end for section
x bool False x-ticks
y int 5 y-ticks,
std bool False flag to standardize
plot_novels('embeddings/A_Modest_Proposal/', start=10, end=15)
Found 10 npy files
---------------------------------------------
Done plotting A Modest Proposal DeCLUTR Small.png
Done plotting A Modest Proposal RoBERTa.png
Done plotting A Modest Proposal InferSent GloVe.png
Done plotting A Modest Proposal InferSent FastText.png
Done plotting A Modest Proposal DistilBERT.png
Done plotting A Modest Proposal XLM.png
Done plotting A Modest Proposal MPNet.png
Done plotting A Modest Proposal USE.png
Done plotting A Modest Proposal DeCLUTR Base.png
Done plotting A Modest Proposal MiniLM.png
<Figure size 432x288 with 0 Axes>

source

plot_histograms

 plot_histograms (path:str, std:bool=False)

Generates histograms for embeddings in the folder

Type Default Details
path str path for embeddings
std bool False flag to standardize

source

ssms_from_pkl

 ssms_from_pkl (path:str, start:int=0, end:int=-1, x:bool=False, y:int=5)

Generates SSMs from pkl files

Type Default Details
path str path for pkl file
start int 0 start for section
end int -1 end for section
x bool False x-ticks
y int 5 y-ticks

source

corr_heatmaps

 corr_heatmaps (path:str, std:bool=False)

Generates correlation plots from normalized SSMs

Type Default Details
path str path for embeddings
std bool False standardize or not

source

corr_ts

 corr_ts (path:str)

Generates correlation plots from time series

Type Details
path str path for embeddings

source

lex_ts

 lex_ts (path:str)

Generate lexical TS from Lexical SSM

Type Details
path str path for embeddings

source

plot_standardized

 plot_standardized (path:str, start:int=0, end:int=-1, x:bool=False,
                    y:int=5)

Generates plots for embeddings in the folder

Type Default Details
path str path for embeddings
start int 0 start for section
end int -1 end for section
x bool False x-ticks
y int 5 y-ticks