绘制箱线图¶
- plot_boxplot(results, labels, relative=False, plot_type='violin', outliers=True, title=None, y_min=None, y_max=None)[source]¶
绘制一个箱线图。
结果的每一行都是针对names中每个元素的独立实验。
- Parameters:
- results: np.array
数据集 x 策略的得分(准确率或错误率)
- labels: list of estimators
包含估计器名称的列表
- relative: bool, default = False
如果为True,则给定数据集的结果将除以中位数结果。
- plot_type: str, default = “violin”
此函数可以创建四种分布图:“violin”(小提琴图)、“swarm”(蜂群图)、“boxplot”(箱线图)或“strip”(带状图)。“violin”图展示了基础分布的核密度估计。“swarm”绘制了一个分类散点图,点被调整以避免重叠。“strip”使用抖动来减少过度绘制,绘制了一个分类散点图。
- outliers: bool, default = True
仅当plot_type为“boxplot”时适用。
- title: str, default = None
要在图表顶部显示的标题。
- y_min: float, default = None
图表y轴的最小值。
- y_max: float, default = None
图表y轴的最大值。
- Returns:
- figmatplotlib.figure.Figure
- axmatplotlib.axes.Axes
示例
>>> from aeon.visualisation import plot_boxplot >>> from aeon.benchmarking.results_loaders import get_estimator_results_as_array >>> methods = ["IT", "WEASEL-Dilation", "HIVECOTE2", "FreshPRINCE"] >>> results = get_estimator_results_as_array(estimators=methods) >>> plot = plot_boxplot(results[0], methods) >>> plot.show() >>> plot.savefig("boxplot.pdf")