HistoPlot Generation
- class SAES.plots.HistoPlot.HistoPlot(data: DataFrame, metrics: DataFrame, metric: str)
Bases:
object
Class to generate histoplots 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 histoplot object with the given data, metrics, and metric.
- save_instance(instance: str, output_path: str):
Generates a histoplot for the specified instance and saves it to the specified output path.
- save_all_instances(output_path: str):
Generates a histoplot for all instances and saves it to the specified output path.
- show_instance(instance: str):
Generates a histoplot for the specified instance and displays it.
- show_all_instances():
Generates a histoplot for all instances and displays it.
- save_all_instances(output_path: str, file_name: str = None, width: int = 30) None
Generates a histoplot for all instances and saves it to the specified output path.
- Args:
- output_path (str):
The path where the histoplot 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 histoplot image.
- Returns:
None
- Example:
>>> frtom SAES.plots.Histoplot import Histoplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> histoplot = Histoplot(data, metrics, metric) >>> histoplot.save_all_instances(os.getcwd())
- save_instance(instance: str, output_path: str, file_name: str = None, width: int = 8) None
Generates a histoplot for the specified instance and saves it to the specified output path.
- Args:
- instance (str):
The name of the instance for which the histoplot is to be generated.
- output_path (str):
The path where the histoplot 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 histoplot image.
- returns:
None
- Example:
>>> frtom SAES.plots.Histoplot import Histoplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> histoplot = Histoplot(data, metrics, metric) >>> histoplot.save_instance("ZDT1", os.getcwd())
- show_all_instances(width: int = 30) None
Generates a histoplot for all instances and displays it.
- Args:
- width (int):
The width of the histoplot image.
- Returns:
None
- Example:
>>> frtom SAES.plots.Histoplot import Histoplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> histoplot = Histoplot(data, metrics, metric) >>> histoplot.show_all_instances()
- show_instance(instance: str, width: int = 8) None
Generates a histoplot for the specified instance and displays it.
- Args:
- instance (str):
The name of the instance for which the histoplot is to be generated.
- width (int):
The width of the histoplot image.
- returns:
None
- Example:
>>> frtom SAES.plots.Histoplot import Histoplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> histoplot = Histoplot(data, metrics, metric) >>> histoplot.show_instance("ZDT1")