Bayesian Posterior Plot Generation
- class SAES.plots.Pplot.Pplot(data: DataFrame, metrics: DataFrame, metric: str, bayesian_test: str = 'sign')
Bases:
object
Class to generate plots for the posterior distribution of a Bayesian statistical test.
- Attributes:
- data (pd.DataFrame):
A pandas DataFrame containing the performance results of different algorithms across multiple instances.
- maximize (bool):
A boolean indicating whether the metric is higher is better.
- algorithms (np.array):
An array containing the names of the algorithms under evaluation.
- metric (str):
The metric to be used for comparison
- logger (Logger):
A logger object to record and display log messages.
- Methods:
- plot(alg1: str, alg2: str, width: int = 5) -> None:
Plots the posterior distribution of the Bayesian statistical test between two algorithms.
- save(alg1: str, alg2: str, output_path: str, file_name: str = None, width: int = 5) -> None:
Saves the posterior distribution of the Bayesian statistical test between two algorithms to a file.
- plot_pivot(algorithm: str, width: int = 30) -> None:
Plots the posterior distribution of the Bayesian statistical test between an algorithm and all other algorithms.
- save_pivot(algorithm: str, output_path: str, file_name: str = None, width: int = 30) -> None:
Saves the posterior distribution of the Bayesian statistical test between an algorithm and all other algorithms to a file.
- save(alg1, alg2, output_path: str, file_name: str = None, width: int = 5, sample_size: int = 2500) None
Saves the posterior distribution of the Bayesian statistical test between two algorithms to a file.
- Args:
- alg1 (str):
The name of the first algorithm.
- alg2 (str):
The name of the second algorithm.
- output_path (str):
The path where the file will be saved.
- file_name (str):
The name of the file. Default is None.
- width (int):
The width of the figure. Default is 5.
- sample_size (int):
Total number of random_search samples generated. Default is 2500.
- Returns:
None
- Example:
>>> frtom SAES.plots.Pplot import Pplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> pplot = Pplot(data, metrics, metric) >>> pplot.save("NSGAII", "OMOPSO", os.getcwd())
- save_pivot(algorithm: str, output_path: str, file_name: str = None, width: int = 30, heigth: int = 15, sample_size: int = 2500) None
Saves the posterior distribution of the Bayesian statistical test between an algorithm and all other algorithms to a file.
- Args:
- algorithm (str):
The name of the algorithm.
- output_path (str):
The path where the file will be saved.
- file_name (str):
The name of the file. Default is None.
- width (int):
The width of the figure. Default is 30.
- heigth (int):
The heigth of the figure. Default is 15.
- sample_size (int):
Total number of random_search samples generated. Default is 2500.
- Returns:
None
- Example:
>>> frtom SAES.plots.Pplot import Pplot >>> import os >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> pplot = Pplot(data, metrics, metric) >>> pplot.save_pivot("NSGAII", os.getcwd())
- show(alg1: str, alg2: str, width: int = 5, sample_size: int = 2500) None
Plots the posterior distribution of the Bayesian statistical test between two algorithms.
- Args:
- alg1 (str):
The name of the first algorithm.
- alg2 (str):
The name of the second algorithm.
- width (int):
The width of the figure. Default is 5.
- sample_size (int):
Total number of random_search samples generated. Default is 2500.
- Returns:
None
- Example:
>>> frtom SAES.plots.Pplot import Pplot >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> pplot = Pplot(data, metrics, metric) >>> pplot.plot("NSGAII", "OMOPSO")
- show_pivot(algorithm: str, width: int = 30, heigth: int = 15, sample_size: int = 2500) None
Plots the posterior distribution of the Bayesian statistical test between an algorithm and all other algorithms.
- Args:
- algorithm (str):
The name of the algorithm.
- width (int):
The width of the figure. Default is 30.
- heigth (int):
The heigth of the figure. Default is 15.
- sample_size (int):
Total number of random_search samples generated. Default is 2500.
- Returns:
None
- Example:
>>> frtom SAES.plots.Pplot import Pplot >>> >>> data = pd.read_csv("data.csv") >>> metrics = pd.read_csv("metrics.csv") >>> metric = "HV" >>> pplot = Pplot(data, metrics, metric) >>> pplot.plot_pivot("NSGAII")