milia.plot.mpl.agreement#
Agreement figures drawn with matplotlib (see milia.plot.figures.agreement).
- milia.plot.mpl.agreement.confusion(pairs, title=None)#
How often two clusters share a conformal prediction set.
- Parameters:
draw – Drawing backend; bound for you in
milia.plot.letsandmilia.plot.mpl.pairs (
DataFrame) – Output ofmilia.cluster.conformal.confusion().
- Returns:
The figure – a lets-plot
PlotSpecor a matplotlibFigure, depending on the backend.
Examples
>>> import numpy as np, pandas as pd >>> from milia.plot.mpl import agreement >>> type(agreement.confusion(pd.DataFrame({"a": [0], "b": [1], "count": [3]}))).__name__ 'Figure'
- milia.plot.mpl.agreement.drift(table, title=None)#
Distance to own and to nearest other centroid over periods.
- Parameters:
draw – Drawing backend; bound for you in
milia.plot.letsandmilia.plot.mpl.table (
DataFrame) – Output ofmilia.cluster.agreement.drift().
- Returns:
The figure – a lets-plot
PlotSpecor a matplotlibFigure, depending on the backend.
Examples
>>> import numpy as np, pandas as pd >>> from milia.plot.mpl import agreement >>> table = pd.DataFrame({"period": ["q1", "q2"], "own": [1.0, 2.0], "other": [3.0, 1.5]}) >>> type(agreement.drift(table)).__name__ 'Figure'
- milia.plot.mpl.agreement.heatmap(table, title=None, value='ari')#
Annotated heatmap of a square agreement table.
- Parameters:
draw – Drawing backend; bound for you in
milia.plot.letsandmilia.plot.mpl.table (
DataFrame) – Square table, e.g. frommilia.cluster.agreement.pairwise().value (
str) – Name of the value shown.
- Returns:
The figure – a lets-plot
PlotSpecor a matplotlibFigure, depending on the backend.
Examples
>>> import numpy as np, pandas as pd >>> from milia.plot.mpl import agreement >>> table = pd.DataFrame([[1.0, 0.5], [0.5, 1.0]], index=["a", "b"], columns=["a", "b"]) >>> type(agreement.heatmap(table)).__name__ 'Figure'
- milia.plot.mpl.agreement.strip(groups, title=None, ylabel='ARI')#
Agreement values per comparison, e.g. seed noise against cross-window drift.
Drift is real only where its values sit below the seed-noise values.
- Parameters:
draw – Drawing backend; bound for you in
milia.plot.letsandmilia.plot.mpl.groups (
Mapping[str,ArrayLike]) – Comparison name to its agreement values.ylabel (
str) – y-axis label.
- Returns:
The figure – a lets-plot
PlotSpecor a matplotlibFigure, depending on the backend.
Examples
>>> import numpy as np, pandas as pd >>> from milia.plot.mpl import agreement >>> type(agreement.strip({"seeds": [0.9, 0.95], "quarters": [0.4, 0.5]})).__name__ 'Figure'
- milia.plot.mpl.agreement.transitions(table, title=None)#
Cluster transitions between two periods.
- Parameters:
draw – Drawing backend; bound for you in
milia.plot.letsandmilia.plot.mpl.table (
DataFrame) – Output ofmilia.cluster.agreement.transitions().
- Returns:
The figure – a lets-plot
PlotSpecor a matplotlibFigure, depending on the backend.
Examples
>>> import numpy as np, pandas as pd >>> from milia.plot.mpl import agreement >>> type(agreement.transitions(pd.crosstab([0, 1, 1], [0, 0, 1]))).__name__ 'Figure'
- milia.plot.mpl.agreement.window(table, metrics=('ari', 'silhouette'), title=None)#
Metrics against the history window.
- Parameters:
draw – Drawing backend; bound for you in
milia.plot.letsandmilia.plot.mpl.table (
DataFrame) – Output ofmilia.cluster.agreement.history().
- Returns:
The figure – a lets-plot
PlotSpecor a matplotlibFigure, depending on the backend.
Examples
>>> import numpy as np, pandas as pd >>> from milia.plot.mpl import agreement >>> table = pd.DataFrame({"window": ["day", "week"], "ari": [0.3, 0.6], "silhouette": [0.2, 0.3]}) >>> type(agreement.window(table)).__name__ 'Figure'