milia.plot.mpl.trust#

Trust figures drawn with matplotlib (see milia.plot.figures.trust).

milia.plot.mpl.trust.calibration(profile, metrics=('strength', 'stability', 'subsample'), title=None)#

Each trust metric against k, on the data and on the structureless null.

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 trust
>>> profile = pd.DataFrame({"k": [2, 3], "strength": [0.9, 0.8], "strengthnull": [0.6, 0.4]})
>>> len(trust.calibration(profile, metrics=("strength",)).axes)
1
milia.plot.mpl.trust.dumbbell(table, label, raw, corrected, title=None)#

Raw against null-corrected score per candidate.

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

  • table (DataFrame) – One row per candidate.

  • label (str) – Column naming each candidate.

  • raw (str) – Column of the raw score.

  • corrected (str) – Column of the corrected score.

  • 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 trust
>>> table = pd.DataFrame({"name": ["a"], "raw": [0.9], "fixed": [0.2]})
>>> type(trust.dumbbell(table, "name", "raw", "fixed")).__name__
'Figure'
milia.plot.mpl.trust.excess(profile, metrics=('strength', 'stability', 'subsample'), title=None)#

Excess of each trust metric over its null, against k, with the zero 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 trust
>>> profile = pd.DataFrame({"k": [2, 3], "strengthexcess": [0.3, 0.4]})
>>> type(trust.excess(profile, metrics=("strength",))).__name__
'Figure'
milia.plot.mpl.trust.importance(table, title=None)#

Hyperparameter importance per objective and evaluator.

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 trust
>>> table = pd.DataFrame(
...     {
...         "evaluator": ["fanova"] * 2,
...         "objective": ["s"] * 2,
...         "parameter": ["k", "scaler"],
...         "importance": [0.7, 0.3],
...     }
... )
>>> type(trust.importance(table)).__name__
'Figure'
milia.plot.mpl.trust.pareto(front, x='separation', y='balance', color='clusterer', title=None)#

Pareto-optimal trials on two objectives, coloured by a parameter.

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 trust
>>> front = pd.DataFrame({"separation": [0.5, 0.6], "balance": [0.9, 0.7], "clusterer": ["k", "g"]})
>>> type(trust.pareto(front)).__name__
'Figure'
milia.plot.mpl.trust.plane(table, label='clusterer', title=None)#

Prediction strength against smallest-cluster stability, with the 0.8 and 0.75 reference lines.

Candidates in the upper right pass both resampling checks.

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 trust
>>> table = pd.DataFrame({"strength": [0.9, 0.5], "stability": [0.8, 0.4], "clusterer": ["a", "b"]})
>>> type(trust.plane(table)).__name__
'Figure'