Geodesics¶
Functionality to compute a pairwise distance matricies between multiple graph representations of your data. Used by the Galaxy
class to construct a galaxy space of stars, specifically to derive metrics of agreement between models and democratize model selection.
Geodesics Functionality¶
- thema.multiverse.universe.geodesics._load_starGraphs(dir: str, graph_filter: Callable = None) dict [source]¶
Load starGraphs in a given directory. This function only returns diagrams for starGraphs that satisfy the constraint given by graph_filter.
- Parameters:
dir (str) – The directory containing the graphs, from which diagrams can be extracted.
graph_filter (Callable, optional) – Default to None (ie no filter). Only select graph object based on filter function criteria (returns 1 to include and 0 to exclude)
- Returns:
A dictionary mapping the graph object file paths to the corresponding persistence diagram object.
- Return type:
dict
- thema.multiverse.universe.geodesics.stellar_kernel_distance(files, filterfunction: Callable = None, kernel='shortest_path')[source]¶
Compute a pairwise distance matrix between graphs based on grakel kernels.
- Parameters:
files (str) – A path pointing to the directory containing starGraphs.
filterfunction (Callable, optional) – A customizable filter function for pulling a subset of cosmic graphs. Default is None.
kernel (str, optional) – The kernel to be used for computing pairwise distances. Default is “shortest_path”.
- Returns:
keys (np.array) – A list of the keys for the models being compared.
distance_matrix (np.ndarray) – A pairwise distance matrix between the persistence landscapes of the starGraphs.