plot.mo.plot_mo

plot.mo.plot_mo(
    target_names,
    combinations,
    pareto,
    y_rf=None,
    pareto_front=False,
    y_best=None,
    y_add=None,
    y_add2=None,
    y_add_color='blue',
    y_add2_color='green',
    title='',
    y_orig=None,
    pareto_front_orig=False,
    pareto_label=False,
    y_rf_color='blue',
    y_best_color='red',
    x_axis_transformation='id',
    y_axis_transformation='id',
    y_best_label='Best',
    y_add_label='Add',
    y_add2_label='Add2',
    filename=None,
    figsize=(9, 6),
)

Generates scatter plots for each combination of two targets from a multi-output prediction while highlighting Pareto optimal points.

Parameters

Name Type Description Default
y_rf np.ndarray The predicted target values with shape (n_samples, n_targets). None
target_names list A list of target names corresponding to the columns of y_rf. required
combinations list A list of tuples, where each tuple contains the indices of the target combinations to plot. required
pareto str Specifies whether to compute Pareto front based on ‘min’ or ‘max’ criterion. required
pareto_front bool If True, connect Pareto optimal points with a red line for y_rf. False
y_best np.ndarray A NumPy array representing the best point to highlight in red. Defaults to None. None
y_add np.ndarray A NumPy array representing the additional points to highlight in blue. Defaults to None. None
y_add2 np.ndarray A NumPy array representing the additional points to highlight in green. Defaults to None. None
y_add_color str The color of the additional points. Defaults to “blue”. 'blue'
y_add2_color str The color of the additional points. Defaults to “green”. 'green'
y_best_label str The label for the best point. Defaults to “Best”. 'Best'
y_add_label str The label for the additional points. Defaults to “Add”. 'Add'
y_add2_label str The label for the additional points. Defaults to “Add2”. 'Add2'
title str The title of the plot. Defaults to “” (empty string). ''
y_orig np.ndarray The original target values with shape (n_samples, n_targets). Defaults to None. None
pareto_front_orig bool If True, connect Pareto optimal points with a light blue line for y_orig. Defaults to False. False
pareto_label bool If True, label Pareto points with their index. Defaults to False. False
y_rf_color str The color of the predicted points. Defaults to “blue”. 'blue'
y_best_color str The color of the best point. Defaults to “red”. 'red'
x_axis_transformation str Transformation for the x-axis. Options are “id” (linear), “log” (logarithmic), and “loglog” (log-log). Defaults to “id”. 'id'
y_axis_transformation str Transformation for the y-axis. Options are “id” (linear), “log” (logarithmic), and “loglog” (log-log). Defaults to “id”. 'id'
filename str If provided, saves the plot to the specified file. Supports “pdf” and “png” formats. Defaults to None. None
figsize tuple Figure size (width, height) in inches. Default is (9, 6). (9, 6)

Returns

Name Type Description
None None Displays or saves the plot.

Examples

>>> from spotoptim.plot.mo import plot_mo
>>> import numpy as np
>>> target_names = ["Target 1", "Target 2"]
>>> combinations = [(0, 1)]
>>> pareto = "min"
>>> y_rf = np.random.rand(100, 2)
>>> y_orig = np.random.rand(100, 2)
>>> plot_mo(target_names, combinations, pareto, y_rf=y_rf, y_orig=y_orig, filename="plot.png")