Plots¶
plots ¶
Plots for qlPCA: scree plot, transformation plots, biplot (matplotlib, imported lazily).
Style: light surface, thin lines, recessive grid, blue for the main series and orange for the comparison series; text stays in neutral ink.
scree_plot ¶
scree_plot(eigenvalues, ax=None, label=None, reference=None, reference_label=None, kaiser=True, title=None)
Scree plot of the eigenvalues of the correlation matrix of the (transformed) variables.
Solutions of different dimension are not nested, so compare the scree plots of p - 1, p and p + 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eigenvalues
|
array - like or QLPCA
|
Eigenvalues, or a fitted model (its |
required |
ax
|
matplotlib Axes
|
Axes to draw on. |
None
|
label
|
str
|
Legend label of the series. |
None
|
reference
|
array - like or QLPCA
|
A second series, for example the PCA eigenvalues. |
None
|
reference_label
|
str
|
Legend label of the reference series. |
None
|
kaiser
|
bool
|
Draw the line eigenvalue = 1. |
True
|
title
|
str
|
Axes title. |
None
|
Returns:
| Type | Description |
|---|---|
matplotlib Axes
|
|
transformation_plots ¶
transformation_plots(model, X, names=None, ncols=4, figsize=None, n_points=200)
Small multiples of the optimal transformations: f_j against the original variable.
Points are the observations, the line is the fitted spline, dashed verticals are the interior knots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
QLPCA
|
A fitted model. |
required |
X
|
array-like of shape (n_samples, n_features)
|
The data the model was fitted on. |
required |
names
|
list of str
|
Variable names (default: |
None
|
ncols
|
int
|
Number of panel columns. |
4
|
figsize
|
tuple
|
Figure size. |
None
|
n_points
|
int
|
Grid points per curve. |
200
|
Returns:
| Type | Description |
|---|---|
matplotlib Figure
|
|
biplot ¶
biplot(model, X=None, names=None, labels=None, components=(0, 1), ax=None, arrow_scale=None)
Biplot: object scores as points and loadings as arrows.
Arrows are rescaled by one common factor so that all tips lie within the range of the scores. The loadings refer to the transformed variables; a variable with a V-shaped transformation has an arbitrary sign (DESIGN D6).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
QLPCA
|
A fitted model. |
required |
X
|
array - like
|
Not used (the training scores are drawn); kept for a uniform signature. |
None
|
names
|
list of str
|
Variable names for the arrows. |
None
|
labels
|
list of str
|
Labels of the points. |
None
|
components
|
tuple of int
|
Components on the horizontal and vertical axes. |
(0, 1)
|
ax
|
matplotlib Axes
|
Axes to draw on. |
None
|
arrow_scale
|
float
|
Factor applied to the loadings (default: chosen automatically). |
None
|
Returns:
| Type | Description |
|---|---|
matplotlib Axes
|
|
set_style ¶
set_style()
Set the matplotlib defaults used by the notebooks (white surface, neutral ink, thin lines).
algorithm_diagram ¶
algorithm_diagram(ax=None)
Flow diagram of the qlPCA algorithm (thesis Figure 3.1), with the ALS loop shaded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
matplotlib Axes
|
Axes to draw on. |
None
|
Returns:
| Type | Description |
|---|---|
matplotlib Axes
|
|