Visualization API¶
Auto-generated from docstrings.
visualization.ecg_plots¶
ECG-specific plotting utilities.
plot_ecg_leads
¶
plot_ecg_leads(ecg: Tensor | ndarray, lead_names: list[str] = None, sampling_rate: int = 500, title: str = 'ECG Signal', figsize: tuple = (15, 10)) -> plt.Figure
Plot all 12 ECG leads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ecg
|
Tensor | ndarray
|
ECG signal of shape (num_leads, seq_length) |
required |
lead_names
|
list[str]
|
Names of leads (default: standard 12-lead names) |
None
|
sampling_rate
|
int
|
Sampling rate in Hz |
500
|
title
|
str
|
Plot title |
'ECG Signal'
|
figsize
|
tuple
|
Figure size |
(15, 10)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/ecg_plots.py
plot_ecg_comparison
¶
plot_ecg_comparison(real: Tensor | ndarray, generated: Tensor | ndarray, lead_idx: int = 0, lead_name: str = 'Lead I', sampling_rate: int = 500, figsize: tuple = (12, 4)) -> plt.Figure
Compare real and generated ECG signals for a single lead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
real
|
Tensor | ndarray
|
Real ECG signal |
required |
generated
|
Tensor | ndarray
|
Generated ECG signal |
required |
lead_idx
|
int
|
Index of lead to plot |
0
|
lead_name
|
str
|
Name of the lead |
'Lead I'
|
sampling_rate
|
int
|
Sampling rate in Hz |
500
|
figsize
|
tuple
|
Figure size |
(12, 4)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/ecg_plots.py
plot_ecg_overlay
¶
plot_ecg_overlay(signals: list[Tensor | ndarray], labels: list[str], lead_idx: int = 0, lead_name: str = 'Lead I', sampling_rate: int = 500, figsize: tuple = (12, 4)) -> plt.Figure
Overlay multiple ECG signals for comparison.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signals
|
list[Tensor | ndarray]
|
List of ECG signals |
required |
labels
|
list[str]
|
Labels for each signal |
required |
lead_idx
|
int
|
Index of lead to plot |
0
|
lead_name
|
str
|
Name of the lead |
'Lead I'
|
sampling_rate
|
int
|
Sampling rate in Hz |
500
|
figsize
|
tuple
|
Figure size |
(12, 4)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/ecg_plots.py
visualization.latent_space¶
Latent space visualization utilities.
plot_latent_space_2d
¶
plot_latent_space_2d(latents: Tensor | ndarray, labels: ndarray = None, method: str = 'pca', title: str = 'Latent Space Visualization', figsize: tuple = (10, 8)) -> plt.Figure
Visualize latent space in 2D using PCA or t-SNE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latents
|
Tensor | ndarray
|
Latent vectors of shape (n_samples, latent_dim, latent_length) or (n_samples, latent_dim) |
required |
labels
|
ndarray
|
Optional labels for coloring points |
None
|
method
|
str
|
"pca" or "tsne" |
'pca'
|
title
|
str
|
Plot title |
'Latent Space Visualization'
|
figsize
|
tuple
|
Figure size |
(10, 8)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/latent_space.py
plot_latent_distribution
¶
Plot distribution of latent dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latents
|
Tensor | ndarray
|
Latent vectors |
required |
figsize
|
tuple
|
Figure size |
(12, 4)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/latent_space.py
visualization.training_curves¶
Training progress visualization utilities.
plot_training_curves
¶
plot_training_curves(train_losses: list[float], val_losses: list[float], metric_name: str = 'Loss', figsize: tuple = (10, 6)) -> plt.Figure
Plot training and validation curves.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
train_losses
|
list[float]
|
Training losses per epoch |
required |
val_losses
|
list[float]
|
Validation losses per epoch |
required |
metric_name
|
str
|
Name of the metric |
'Loss'
|
figsize
|
tuple
|
Figure size |
(10, 6)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/training_curves.py
plot_multiple_metrics
¶
plot_multiple_metrics(metrics_dict: dict[str, dict[str, list[float]]], figsize: tuple = (15, 10)) -> plt.Figure
Plot multiple metrics in subplots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics_dict
|
dict[str, dict[str, list[float]]]
|
Dictionary of metrics, e.g.: {"loss": {"train": [...], "val": [...]}, "accuracy": {"train": [...], "val": [...]}} |
required |
figsize
|
tuple
|
Figure size |
(15, 10)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |
Source code in visualization/training_curves.py
plot_learning_rate_schedule
¶
Plot learning rate schedule over epochs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
learning_rates
|
list[float]
|
Learning rates per epoch |
required |
figsize
|
tuple
|
Figure size |
(10, 4)
|
Returns:
| Type | Description |
|---|---|
Figure
|
matplotlib Figure object |