Utils

This module tries to include most of the plotting functionality available in the package

source

Plot

 Plot (path:str)

Plotting module

Type Details
path str path to embeddings

source

Plot.get_normalized

 Plot.get_normalized ()

Returns the normalized ssms


source

Plot.get_raw_ssms

 Plot.get_raw_ssms ()

Returns the raw ssms


source

Plot.get_standardized

 Plot.get_standardized ()

Returns the standardized ssms

p = Path('.')
e = p.absolute().parent.parent/'mnt'/'e'
coll_repr(e.ls(), 2)
plotter = Plot(e/'A_Modest_Proposal_cleaned')
plotter.path.stem.replace('_', ' ')
'A Modest Proposal cleaned'
plotter
This object contains the path to `/mnt/e/A_Modest_Proposal_cleaned`
# d = plotter.get_normalized()
d = plotter.get_standardized()
for k, v in d.items():
    print(v.shape)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
(68, 68)
d.keys()
dict_keys(['DeCLUTR Base', 'DeCLUTR Small', 'DistilBERT', 'InferSent FastText', 'InferSent GloVe', 'MiniLM', 'MPNet', 'RoBERTa', 'USE', 'XLM'])
plotter.get_sectional_ssms(0, -1, True)
Done plotting A Modest Proposal DeCLUTR Base.png
Done plotting A Modest Proposal DeCLUTR Small.png
Done plotting A Modest Proposal DistilBERT.png
Done plotting A Modest Proposal InferSent FastText.png
Done plotting A Modest Proposal InferSent GloVe.png
Done plotting A Modest Proposal MiniLM.png
Done plotting A Modest Proposal MPNet.png
Done plotting A Modest Proposal RoBERTa.png
Done plotting A Modest Proposal USE.png
Done plotting A Modest Proposal XLM.png
<Figure size 432x288 with 0 Axes>
plotter.create_ssms()
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 MPNet.png
Done plotting A Modest Proposal USE.png
Done plotting A Modest Proposal DeCLUTR Base.png
<Figure size 432x288 with 0 Axes>
class Foo:
    def __init__(self, i):
        self.i = i
    def __repr__(self):
        return f'Init value in i is {self.i}'
    def __str__(self):
        return f'idk what this does'
x = Foo(5)
x
Init value in i is 5
print(x)
idk what this does