milia.plot.mpl.represent#

Represent figures drawn with matplotlib (see milia.plot.figures.represent).

milia.plot.mpl.represent.ablation(table, axis, metric, facet=None, title=None)#

A metric per setting of the ablated step.

Parameters:
Returns:

The figure – a lets-plot PlotSpec or a matplotlib Figure, depending on the backend.

Examples

>>> import numpy as np, pandas as pd
>>> from milia.plot.mpl import represent
>>> table = pd.DataFrame({"scaler": ["std", "robust"], "silhouette": [0.3, 0.4]})
>>> type(represent.ablation(table, "scaler", "silhouette")).__name__
'Figure'
milia.plot.mpl.represent.components(table, metric, by='reducer', n='components', title=None)#

A metric against the retained number of components, one line per reducer.

Parameters:
  • draw – Drawing backend; bound for you in milia.plot.lets and milia.plot.mpl.

  • table (DataFrame) – One row per reducer and component count.

  • metric (str) – Metric drawn.

  • by (str) – Column naming the reducer.

  • n (str) – Column with the component count.

  • title (str | None) – Figure title.

Returns:

The figure – a lets-plot PlotSpec or a matplotlib Figure, depending on the backend.

Examples

>>> import numpy as np, pandas as pd
>>> from milia.plot.mpl import represent
>>> table = pd.DataFrame({"components": [2, 5], "ari": [0.5, 0.6], "reducer": ["pca", "pca"]})
>>> type(represent.components(table, "ari")).__name__
'Figure'
milia.plot.mpl.represent.daytypes(sets, names=None, title=None)#

Each meter’s CROCS representative days, one panel per meter, labelled by frequency.

Parameters:
Returns:

The figure – a lets-plot PlotSpec or a matplotlib Figure, depending on the backend.

Examples

>>> import numpy as np, pandas as pd
>>> from milia.plot.mpl import represent
>>> from milia.represent.crocs import RLS
>>> sets = [RLS(np.ones((2, 24)), np.array([0.5, 0.5]))]
>>> len(represent.daytypes(sets).axes)
1
milia.plot.mpl.represent.recovery(table, axis, title=None)#

Known-group recovery per setting, with the 0.5 line.

Parameters:
Returns:

The figure – a lets-plot PlotSpec or a matplotlib Figure, depending on the backend.

Examples

>>> import numpy as np, pandas as pd
>>> from milia.plot.mpl import represent
>>> table = pd.DataFrame({"scaler": ["std", "robust"], "recovery": [0.3, 0.8]})
>>> type(represent.recovery(table, "scaler")).__name__
'Figure'
milia.plot.mpl.represent.spectrum(eigenvalues, title=None)#

Eigenvalue spectra per embedding: where is the gap?

Parameters:
Returns:

The figure – a lets-plot PlotSpec or a matplotlib Figure, depending on the backend.

Examples

>>> import numpy as np, pandas as pd
>>> from milia.plot.mpl import represent
>>> type(represent.spectrum({"tucker": [0.9, 0.5, 0.1]})).__name__
'Figure'