BestEmbeddingResult

class hybrid_learning.concepts.analysis.results.BestEmbeddingResult(results)[source]

Bases: ResultsHandle

Handle for results on layer-wise reduction or analysis results to best embeddings. The handle can save and load results, as well as provide different representations (see to_pandas()). The results are saved in results. See there for the format.

Public Methods:

to_pandas()

Provide pandas.DataFrame indexed by layer ID wt/ info about embeddings.

save(folder_path)

Save results of embedding reduction.

Inherited from : py: class:ResultsHandle

save(folder_path)

Save results of embedding reduction.

to_pandas()

Provide pandas.DataFrame indexed by layer ID wt/ info about embeddings.

Special Methods:

__init__(results)

Inherited from : py: class:ResultsHandle

__repr__()

Return repr(self).


Parameters

results (Dict[str, Tuple[ConceptEmbedding, Tuple[ndarray, float, float], Series]]) –

__init__(results)[source]
Parameters

results (Dict[str, Tuple[ConceptEmbedding, Tuple[ndarray, float, float], Series]]) –

classmethod load(folder_path)[source]

Load previously saved results for best embeddings. Note that the standard deviation information cannot be fully retrieved, as the standard deviation vector is replaced by its length during saving.

Parameters

folder_path (str) –

Return type

BestEmbeddingResult

save(folder_path)[source]

Save results of embedding reduction. The following is saved:

  • embeddings as folder_path/layer_id\ best.pt

  • merged stats and standard deviation info as folder_path/best_emb_stats.csv

Parameters

folder_path (str) –

to_pandas()[source]

Provide pandas.DataFrame indexed by layer ID wt/ info about embeddings.

Return type

DataFrame

results: Dict[str, Tuple[ConceptEmbedding, Tuple[numpy.ndarray, float, float], pandas.core.series.Series]]

The actual results dictionary of the form {layer_id: info_tuple} where the info_tuple holds:

  • the best concept embedding of the layer,

  • the standard deviation results,

  • the metric results when evaluated on its concept