analysis.umap
logger_config
logger
umap_embedding
def umap_embedding(
cfg: dict, session: str, model_name: str, n_clusters: int,
segmentation_algorithm: SegmentationAlgorithms) -> np.ndarray
Perform UMAP embedding for given file and parameters.
Parameters
- cfg (
dict
): Configuration parameters. - session (
str
): Session name. - model_name (
str
): Model name. - n_clusters (
int
): Number of clusters. - segmentation_algorithm (
str
): Segmentation algorithm.
Returns
np.ndarray
: UMAP embedding.
umap_vis
def umap_vis(embed: np.ndarray, num_points: int) -> plt.Figure
Visualize UMAP embedding without labels.
Parameters
- embed (
np.ndarray
): UMAP embedding. - num_points (
int
): Number of data points to visualize.
Returns
plt.Figure
: Plot Visualization of UMAP embedding.
umap_label_vis
def umap_label_vis(embed: np.ndarray, label: np.ndarray,
num_points: int) -> plt.Figure
Visualize UMAP embedding with motif labels.
Parameters
- embed (
np.ndarray
): UMAP embedding. - label (
np.ndarray
): Motif labels. - num_points (
int
): Number of data points to visualize.
Returns
plt.Figure
: Plot figure of UMAP visualization embedding with motif labels.
umap_vis_comm
def umap_vis_comm(embed: np.ndarray, community_label: np.ndarray,
num_points: int) -> plt.Figure
Visualize UMAP embedding with community labels.
Parameters
- embed (
np.ndarray
): UMAP embedding. - community_label (
np.ndarray
): Community labels. - num_points (
int
): Number of data points to visualize.
Returns
plt.Figure
: Plot figure of UMAP visualization embedding with community labels.
visualize_umap
@save_state(model=VisualizeUmapFunctionSchema)
def visualize_umap(config: dict,
segmentation_algorithm: SegmentationAlgorithms,
label: Optional[str] = None,
save_logs: bool = False) -> None
Visualize UMAP embeddings based on configuration settings. Fills in the values in the "visualization" key of the states.json file. Saves results files at:
If label is None (UMAP visualization without labels):
- project_name/
- results/
- file_name/
- model_name/
- segmentation_algorithm-n_clusters/
- community/
- umap_embedding_file_name.npy
- umap_vis_label_none_file_name.png (UMAP visualization without labels)
- umap_vis_motif_file_name.png (UMAP visualization with motif labels)
- umap_vis_community_file_name.png (UMAP visualization with community labels)
- community/
- segmentation_algorithm-n_clusters/
- model_name/
- file_name/
- results/
Parameters
- config (
dict
): Configuration parameters. - segmentation_algorithm (
SegmentationAlgorithms
): Which segmentation algorithm to use. Options are 'hmm' or 'kmeans'. - label (
str, optional
): Type of labels to visualize. Options are None, 'motif' or 'community'. Default is None. - save_logs (
bool, optional
): Save logs to file. Default is False.
Returns
None