plot_rand_lambda_MAP_region
Attributes
Functions
|
Plot a 3D scatter plot comparing feasible and random lambda values for three specified metrics. |
|
Generate 2D subplots for lambda values, with one subplot for each CSV file. |
Module Contents
- plot_rand_lambda_MAP_region.plot_lambdas_3D(file_path: str, x_value: str, y_value: str, z_value: str, output_prefix: str) None
Plot a 3D scatter plot comparing feasible and random lambda values for three specified metrics.
This function generates a 3D scatter plot using optimized and Dirichlet (random) lambda values for three specified metrics. The plot helps visualize the subregion of MAP-feasible lambdas for models aligned to specific human values.
- Parameters:
file_path (str) – Path to the CSV file containing lambda values for the specified metrics.
x_value (str) – Metric name for the x-axis (e.g., ‘gpt2-helpful’).
y_value (str) – Metric name for the y-axis (e.g., ‘gpt2-harmless’).
z_value (str) – Metric name for the z-axis (e.g., ‘humor’).
output_prefix (str) – Prefix for the output PDF file where the plot will be saved.
Example
>>> plot_lambdas_3D("plot_rand_lambda_6scale_3D.csv", "gpt2-helpful", "gpt2-harmless", "humor", "results/lambda_3D_plot")
- plot_rand_lambda_MAP_region.plot_lambdas_2D_subplots(file_paths: list[str], x_value: str, y_value: str, output_prefix: str) None
Generate 2D subplots for lambda values, with one subplot for each CSV file.
This function creates multiple 2D scatter plots for optimized and Dirichlet (random) lambda values for two specified metrics, displaying one subplot per CSV file. This helps to analyze the shrinkage of feasible lambda regions as more values are considered.
- Parameters:
file_paths (list[str]) – List of CSV file paths containing lambda values for each subplot.
x_value (str) – Metric name for the x-axis (e.g., ‘gpt2-helpful’).
y_value (str) – Metric name for the y-axis (e.g., ‘gpt2-harmless’).
output_prefix (str) – Prefix for the output PDF file where the plot will be saved.
Example
>>> file_paths = ["lambda_data_2D.csv", "lambda_data_3D.csv"] >>> plot_lambdas_2D_subplots(file_paths, "gpt2-helpful", "gpt2-harmless", "results/lambda_2D_subplots")
- plot_rand_lambda_MAP_region.x_value = 'gpt2-helpful'