milia.plot.figures.trust#
Trust figures: the resampling trust plane, null calibration and the Pareto front.
Functions
|
Each trust metric against k, on the data and on the structureless null. |
|
Raw against null-corrected score per candidate. |
|
Excess of each trust metric over its null, against k, with the zero line. |
|
Hyperparameter importance per objective and evaluator. |
|
Pareto-optimal trials on two objectives, coloured by a parameter. |
|
Prediction strength against smallest-cluster stability, with the 0.8 and 0.75 reference lines. |
- milia.plot.figures.trust.plane(draw, 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:
draw (
ModuleType) – Drawing backend; bound for you inmilia.plot.letsandmilia.plot.mpl.table (
DataFrame) – One row per candidate withstrengthandstability.label (
str) – Column labelling each point.
- 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 trust >>> table = pd.DataFrame({"strength": [0.9, 0.5], "stability": [0.8, 0.4], "clusterer": ["a", "b"]}) >>> type(trust.plane(table)).__name__ 'Figure'
- milia.plot.figures.trust.calibration(draw, profile, metrics=('strength', 'stability', 'subsample'), title=None)#
Each trust metric against k, on the data and on the structureless null.
- Parameters:
draw (
ModuleType) – Drawing backend; bound for you inmilia.plot.letsandmilia.plot.mpl.profile (
DataFrame) – Output ofmilia.cluster.stability.calibrated().
- 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 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.figures.trust.excess(draw, profile, metrics=('strength', 'stability', 'subsample'), title=None)#
Excess of each trust metric over its null, against k, with the zero line.
- Parameters:
draw (
ModuleType) – Drawing backend; bound for you inmilia.plot.letsandmilia.plot.mpl.profile (
DataFrame) – Output ofmilia.cluster.stability.calibrated().
- 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 trust >>> profile = pd.DataFrame({"k": [2, 3], "strengthexcess": [0.3, 0.4]}) >>> type(trust.excess(profile, metrics=("strength",))).__name__ 'Figure'
- milia.plot.figures.trust.dumbbell(draw, table, label, raw, corrected, title=None)#
Raw against null-corrected score per candidate.
- Parameters:
draw (
ModuleType) – Drawing backend; bound for you inmilia.plot.letsandmilia.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.
- 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 trust >>> table = pd.DataFrame({"name": ["a"], "raw": [0.9], "fixed": [0.2]}) >>> type(trust.dumbbell(table, "name", "raw", "fixed")).__name__ 'Figure'
- milia.plot.figures.trust.pareto(draw, front, x='separation', y='balance', color='clusterer', title=None)#
Pareto-optimal trials on two objectives, coloured by a parameter.
- Parameters:
draw (
ModuleType) – Drawing backend; bound for you inmilia.plot.letsandmilia.plot.mpl.front (
DataFrame) – Output ofmilia.cluster.search.pareto().x (
str) – Objective on the x axis.y (
str) – Objective on the y axis.color (
str) – Parameter colouring the points.
- 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 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.figures.trust.importance(draw, table, title=None)#
Hyperparameter importance per objective and evaluator.
- Parameters:
draw (
ModuleType) – Drawing backend; bound for you inmilia.plot.letsandmilia.plot.mpl.table (
DataFrame) – Output ofmilia.cluster.search.importance().
- 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 trust >>> table = pd.DataFrame( ... { ... "evaluator": ["fanova"] * 2, ... "objective": ["s"] * 2, ... "parameter": ["k", "scaler"], ... "importance": [0.7, 0.3], ... } ... ) >>> type(trust.importance(table)).__name__ 'Figure'