Boxplot Generation
- class SAES.plots.boxplot.Boxplot(data: DataFrame, metrics: DataFrame, metric: str)
Bases:
object
Class to generate boxplots for the performance of different algorithms across multiple instances.
- Attributes:
- data (pd.DataFrame):
A pandas DataFrame containing the performance results of different algorithms across multiple instances.
- metric (str):
The metric to be used for comparison.
- instances (np.ndarray):
An array containing the names of the instances.
- logger (Logger):
A logger object to record and display log messages.
- Methods:
- __init__(data: pd.DataFrame, metrics: pd.DataFrame, metric: str):
Initializes the Boxplot object with the given data, metrics, and metric.
- save_instance(instance: str, output_path: str):
Generates a boxplot for the specified instance and saves it to the specified output path.
- save_all_instances(output_path: str):
Generates a boxplot for all instances and saves it to the specified output path.
- show_instance(instance: str):
Generates a boxplot for the specified instance and displays it.
- show_all_instances():
Generates a boxplot for all instances and displays it.
- save_all_instances(output_path: str, file_name: str = None, width: int = 30) None
Generates a boxplot for all instances and saves it to the specified output path.
- Args:
- output_path (str):
The path where the boxplot image will be saved.
- file_name (str):
The name of the file to be saved. If None, a default name will be used.
- width (int):
The width of the boxplot image.
- Returns:
None
- Example:
>>> frtom SAES.plots.boxplot import Boxplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> boxplot = Boxplot(data, metrics, metric) >>> boxplot.save_all_instances(os.getcwd())
- save_instance(instance: str, output_path: str, file_name: str = None, width: int = 8) None
Generates a boxplot for the specified instance and saves it to the specified output path.
- Args:
- instance (str):
The name of the instance for which the boxplot is to be generated.
- output_path (str):
The path where the boxplot image will be saved.
- file_name (str):
The name of the file to be saved. If None, a default name will be used.
- width (int):
The width of the boxplot image.
- returns:
None
- Example:
>>> frtom SAES.plots.boxplot import Boxplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> boxplot = Boxplot(data, metrics, metric) >>> boxplot.save_instance("ZDT1", os.getcwd())
- show_all_instances(width: int = 30) None
Generates a boxplot for all instances and displays it.
- Args:
- width (int):
The width of the boxplot image.
- Returns:
None
- Example:
>>> frtom SAES.plots.boxplot import Boxplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> boxplot = Boxplot(data, metrics, metric) >>> boxplot.show_all_instances()
- show_instance(instance: str, width: int = 8) None
Generates a boxplot for the specified instance and displays it.
- Args:
- instance (str):
The name of the instance for which the boxplot is to be generated.
- width (int):
The width of the boxplot image.
- returns:
None
- Example:
>>> frtom SAES.plots.boxplot import Boxplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> boxplot = Boxplot(data, metrics, metric) >>> boxplot.show_instance("ZDT1")