qxmt.visualization.plot_metrics module#
- qxmt.visualization.plot_metrics.plot_metric(df, metric, chart_type='bar', run_id_col='run_id', run_ids=None, save_path=None, logger=<Logger qxmt.visualization.plot_metrics (INFO)>, **kwargs)
Plot bar chart of the target metric. x-axis is run_id.
- Parameters:
df (pd.DataFrame) – dataframe that contains the calculated metrics
metric (str) – target metric name
chart_type (Literal["bar", "line"], optional) – chart type (“bar” or “line”). Defaults to “bar”.
run_id_col (str, optional) – column name of run_id. Defaults to RUN_ID_COL.
run_ids (Optional[list[int]], optional) – run_ids to plot. Defaults to None.
save_path (Optional[Path], optional) – save path for the plot. Defaults to None.
logger (Logger, optional) – logger object. Defaults to LOGGER.
**kwargs (Any) – additional arguments for plot. xlabel (Optional[str], optional): x-axis label. Defaults to “run_id”. ylabel (Optional[str], optional): y-axis label. Defaults to f’”{valid_metric}” score’. ylim (Optional[tuple[float, float]], optional): y-axis limit. Defaults to None. grid (Optional[bool], optional): grid option. Defaults to True. title (Optional[str], optional): title of the plot. Defaults to None.
- Return type:
None
- qxmt.visualization.plot_metrics.plot_metrics_side_by_side(df, metrics, chart_type='bar', run_id_col='run_id', run_ids=None, save_path=None, logger=<Logger qxmt.visualization.plot_metrics (INFO)>, **kwargs)
Plot bar chart of the target metrics side by side. x-axis is run_id.
- Parameters:
df (pd.DataFrame) – dataframe that contains the calculated metrics
metrics (list[str]) – target metric names
chart_type (Literal["bar", "line"], optional) – chart type (“bar” or “line”). Defaults to “bar”.
run_id_col (str, optional) – column name of run_id. Defaults to RUN_ID_COL.
run_ids (Optional[list[int]], optional) – run_ids to plot. Defaults to None.
save_path (Optional[Path], optional) – save path for the plot. Defaults to None.
logger (Logger, optional) – logger object. Defaults to LOGGER.
**kwargs (Any) – additional arguments for plot. xlabel (Optional[str], optional): x-axis label. Defaults to “run_id”. ylabel (Optional[str], optional): y-axis label. Defaults to “metrics score”. ylim (Optional[tuple[float, float]], optional): y-axis limit. Defaults to None. grid (Optional[bool], optional): grid option. Defaults to True. title (Optional[str], optional): title of the plot. Defaults to None.
- Return type:
None