AnalysisResult
- class hybrid_learning.concepts.analysis.results.AnalysisResult(results)[source]
Bases:
ResultsHandleHandle for saving, loading and inspection of analysis results. The results are saved in
results. See there for the format.Public Methods:
items()Emulate an items view that yields an analysis result per layer ID.
result_for(layer_id)Return the results for a single layer.
save(folder_path)Save analysis results.
Provide
pandas.DataFramemulti-indexed by layer and run w/ info for each run.Special Methods:
__init__(results)Inherited from : py: class:ResultsHandle
__repr__()Return repr(self).
- classmethod load(folder_path)[source]
Load analysis results previously saved. The saving format is assumed to be that of
save().- Parameters
folder_path (str) –
- Return type
- result_for(layer_id)[source]
Return the results for a single layer.
- Parameters
layer_id (str) –
- Return type
- save(folder_path)[source]
Save analysis results. The format is one retrievable by
load(). The results are saved in the following files withinfolder_path<layer> <run> <i>.pt: torch PT file with ith embedding resulting from<run>on<layer>; can be loaded to an embedding usinghybrid_learning.concepts.models.embeddings.ConceptEmbedding.load()stats.csv: CSV file holding apandas.DataFramewith each rows holding an embedding statistics; additional columns are'layer','run', and'embedding_{i}', where the'embedding_{i}'column holds the path to the ith PT-saved embedding corresponding of the row relative to the location ofstats.csv
Note
Also the .npz legacy format is accepted and determined from the file ending.
- Parameters
folder_path (str) – the root folder to save files under; must not yet exist
- to_pandas()[source]
Provide
pandas.DataFramemulti-indexed by layer and run w/ info for each run. The information for each run is the one obtained byemb_info_to_pandas().- Returns
a
pandas.DataFramewith run result information multi-indexed by(layer, run)
- results: Dict[str, Dict[int, Tuple[Sequence[ConceptEmbedding], pandas.core.series.Series]]]
The dict storage of the managed results. Format:
{layer_id: {run: ([embedding1, embedding2, ...], results_series)}}.