milia.plot.lets.recommend#

Recommend figures drawn with lets-plot (see milia.plot.figures.recommend).

milia.plot.lets.recommend.interval(ranked, label, top=15, title=None)#

Rank with its bootstrap interval for the top entities.

Overlapping intervals mean the order is not settled.

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 recommend
>>> ranked = pd.DataFrame({"name": ["a", "b"], "rank": [1, 2], "lower": [1, 1], "upper": [2, 2]})
>>> type(recommend.interval(ranked, "name")).__name__
'Figure'
milia.plot.lets.recommend.methods(table, metric='mae', title=None)#

One metric per method from a benchmark table.

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 recommend
>>> type(recommend.methods(pd.DataFrame({"mae": [1.0, 2.0]}, index=["knn", "mean"]))).__name__
'Figure'
milia.plot.lets.recommend.outcomes(labels, frame, column, title=None)#

An outcome’s values per cluster: does the archetype explain risk?

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 recommend
>>> type(recommend.outcomes([0, 1, 1], pd.DataFrame({"risk": [1.0, 2.0, 3.0]}), "risk")).__name__
'Figure'
milia.plot.lets.recommend.top(frame, label, value, n=10, facet=None, title=None)#

Horizontal bars of the largest values, optionally per facet.

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

  • frame (DataFrame) – One row per entity.

  • label (str) – Column naming each entity.

  • value (str) – Column ranked on.

  • n (int) – Entities kept (per facet).

  • facet (str | None) – Column splitting panels.

  • 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 recommend
>>> frame = pd.DataFrame({"name": list("abc"), "v": [1, 4, 2]})
>>> type(recommend.top(frame, "name", "v", n=2)).__name__
'Figure'
milia.plot.lets.recommend.trust(distances, tau, title=None)#

Nearest-neighbour distances, trusted and flagged, with the calibrated radius.

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 recommend
>>> type(recommend.trust(np.linspace(0, 1, 20), 0.6)).__name__
'Figure'
milia.plot.lets.recommend.variance(table, title=None)#

Within-entity to overall variance ratio per metric, with the line at one.

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 recommend
>>> type(recommend.variance(pd.DataFrame({"metric": ["v"], "ratio": [0.4]}))).__name__
'Figure'