Plotting¶
scree_plot ¶
Plot explained variance ratio per component (scree plot).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
VBPCA | VBPCA
|
A fitted |
required |
ax
|
Axes | None
|
Optional matplotlib |
None
|
cumulative
|
bool
|
If True, overlay a cumulative variance line. |
True
|
Returns:
| Type | Description |
|---|---|
Figure
|
The matplotlib |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the model has not been fitted or lacks explained-variance information. |
loadings_barplot ¶
loadings_barplot(model: VBPCA | VBPCA, component: int = 0, *, ax: Axes | None = None, top_n: int | None = None, feature_names: list[str] | None = None) -> Figure
Bar plot of loadings (weights) for a single component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
VBPCA | VBPCA
|
A fitted |
required |
component
|
int
|
Zero-based component index. |
0
|
ax
|
Axes | None
|
Optional matplotlib |
None
|
top_n
|
int | None
|
If set, show only the top_n features by absolute loading. |
None
|
feature_names
|
list[str] | None
|
Optional labels for the feature axis. |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
The matplotlib |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the model has not been fitted. |
variance_explained_plot ¶
Plot per-component explained variance (absolute, not ratio).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
VBPCA | VBPCA
|
A fitted |
required |
ax
|
Axes | None
|
Optional matplotlib |
None
|
Returns:
| Type | Description |
|---|---|
Figure
|
The matplotlib |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the model has not been fitted or lacks explained-variance information. |