beetroots.inversion.results.utils package

Subpackages

Submodules

beetroots.inversion.results.utils.abstract_util module

class beetroots.inversion.results.utils.abstract_util.ResultsUtil[source]

Bases: ABC

abstract class for the extraction of a specific result from the data saved during an inversion. All the daughter classes have three key methods:

  • read_data, to read the data necessary for the computation of the specific result of interest

  • create_folders, to create the folders where the specific result is to be saved

  • main, to run the two previous methods and compute the specific result

abstract create_folders(**kwargs) str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

abstract main(**kwargs)[source]

runs the two previous methods and compute the specific result

abstract read_data(list_chains_folders: List[str], **kwargs)[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.bayes_pval_plots module

class beetroots.inversion.results.utils.bayes_pval_plots.ResultsBayesPvalues(model_name: str, chain_type: str, path_img: str, path_data_csv_out: str, N_MCMC: int, N: int, D_sampling: int, plot_ESS: bool)[source]

Bases: ResultsUtil

Bayesian model checking accounting for uncertainties on the p-value due to Monte Carlo evaluation. The method is described in Palud et al. [2023].

CONFIDENCE_THRESHOLD_ALPHA = 0.05

…, denoted \(\alpha\) in the article

CONFIDENCE_THRESHOLD_DELTA = 0.1

…, denoted \(\delta\) in the article

D
ESS_OPTIM = 1000

number of random reproduced observations to draw to evaluate the model checking p-value for optimization procedures

N
N_MCMC
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

main(list_idx_sampling: List[int], map_shaper: MapShaper | None) None[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out
path_img
read_data() Tuple[DataFrame | None, DataFrame][source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.clppd module

class beetroots.inversion.results.utils.clppd.ResultsCLPPD(model_name: str, chain_type: str, path_img: str, path_data_csv_out: str, N_MCMC: int, N: int, L: int)[source]

Bases: ResultsUtil

D
N
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

main(list_chains_folders: List[str], map_shaper: MapShaper | None) None[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out
path_img
read_data(list_chains_folders: List[str]) Tuple[ndarray, ndarray][source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.ess_plots module

class beetroots.inversion.results.utils.ess_plots.ResultsESS(model_name: str, path_img: str, path_data_csv_out_mcmc: str, N: int, D_sampling: int)[source]

Bases: ResultsUtil

D
N
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

main(map_shaper: MapShaper, list_names: List[str], list_idx_sampling: List[int]) None[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out_mcmc
path_img
read_data() DataFrame[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.kernel module

class beetroots.inversion.results.utils.kernel.ResultsKernels(model_name: str, chain_type: str, path_img: str, N_run: int, T: int, freq_save: int)[source]

Bases: ResultsUtil

N_run
chain_type
create_folders() Tuple[str, str][source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_T
main(list_chains_folders: List[str]) None[source]

runs the two previous methods and compute the specific result

model_name
path_img
plot_accept_freq(folder_path: str, list_type: ndarray, list_accepted: ndarray) None[source]
plot_log_proba_accept(folder_path: str, list_type: ndarray, list_log_proba: ndarray) None[source]

plots log proba accept per kernel

read_data(list_chains_folders: List[str]) Tuple[ndarray, ndarray, ndarray][source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.lowest_obj_estimator module

class beetroots.inversion.results.utils.lowest_obj_estimator.ResultsLowestObjective(model_name: str, chain_type: str, path_img: str, path_data_csv_out: str, N_run: int, T: int, freq_save: int)[source]

Bases: ResultsUtil

N_run
chain_type
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_T
main(list_chains_folders: List[str], lowest_obj: float, idx_lowest_obj: int, scaler: Scaler, Theta_true_scaled_full: ndarray | None, list_idx_sampling: List[int], list_fixed_values: ndarray, estimator_plot: PlotsEstimator | None) None[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out
path_img
read_data(list_chains_folders: List[str], idx_lowest_obj: int) ndarray[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

save_estimator_to_csv(Theta_lowest_obj_lin_full: ndarray, estimator_name: str) None[source]

beetroots.inversion.results.utils.mc module

class beetroots.inversion.results.utils.mc.ResultsMC(model_name: str, chain_type: str, path_img: str, path_data_csv_out_mcmc: str, max_workers: int, N_MCMC: int, T_MC: int, T_BI: int, freq_save: int, N: int, list_idx_sampling: List, list_fixed_values_scaled: List, lower_bounds_lin: ndarray | List[float], upper_bounds_lin: ndarray | List[float], list_names: List[str])[source]

Bases: ResultsUtil

D
N
N_MCMC
T_BI
T_MC
chain_type
create_folders() Tuple[str, str, str, str, str][source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_T_BI
freq_save
full_mc_analysis(scaler: Scaler, Theta_true_scaled_full: ndarray | None, list_mcmc_folders: List[str], plot_ESS: bool, plot_1D_chains: bool, plot_2D_chains: bool, plot_comparisons_yspace: bool, folder_path_1D_chain: str, folder_path_1D_hist: str, folder_path_2D_chain: str, folder_path_2D_hist: str, folder_path_2D_proba: str, point_challenger: Dict = {}, list_CI: List[int] = []) None[source]
list_names
lower_bounds_lin
main(scaler: Scaler, Theta_true_scaled_full: ndarray | None, list_mcmc_folders: List[str], plot_ESS: bool, plot_1D_chains: bool, plot_2D_chains: bool, plot_comparisons_yspace: bool, point_challenger: Dict = {}, list_CI: List[int] = [])[source]

runs the two previous methods and compute the specific result

max_workers
model_name
path_data_csv_out_mcmc
path_img
read_data()[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

upper_bounds_lin

beetroots.inversion.results.utils.mmse_ci module

class beetroots.inversion.results.utils.mmse_ci.ResultsMMSEandCI(model_name: str, path_img: str, path_data_csv_out_mcmc: str, N: int, D: int)[source]

Bases: ResultsUtil

D
N
create_folders(list_CI: List[int]) Tuple[str, dict[int, str]][source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

main(posterior: Posterior, scaler: Scaler, estimator_plot: PlotsEstimator | None, Theta_true_scaled_full: ndarray | None, list_idx_sampling: List[int], list_fixed_values: ndarray, list_CI: List[int]) DataFrame[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out_mcmc
path_img
read_data() DataFrame[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.objective module

class beetroots.inversion.results.utils.objective.ResultsObjective(model_name: str, chain_type: str, path_img: str, N_MCMC: int, T_MC: int, T_BI: int, freq_save: int, N: int, D: int, L: int)[source]

Bases: ResultsUtil

N_MCMC
chain_type
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_T_BI
effective_T_MC
find_lowest_objective(list_objective: ndarray) Tuple[int, float][source]
main(list_chains_folders: List[str], objective_true: float | None) Tuple[int, float][source]

runs the two previous methods and compute the specific result

model_name
path_img
plot_normalized_nll(folder_path: str, list_nll: ndarray) None[source]
plot_objective(folder_path: str, list_objective: ndarray, list_nll: ndarray, objective_true: float | None)[source]
read_data(list_chains_folders: List[str]) Tuple[ndarray, ndarray][source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.perf_saver module

class beetroots.inversion.results.utils.perf_saver.EstimatorPerfSaver[source]

Bases: object

static compute_MSE(Theta_estimate: ndarray, Theta_true: ndarray, component_wise: bool = False)[source]
static compute_SNR(Theta_estimate: ndarray, Theta_true: ndarray, component_wise: bool = False)[source]
static estimate_point_with_lowest_obj(list_Theta_lin: ndarray, list_objective: ndarray) Tuple[ndarray, float][source]
save_estimator_performance(path_data_csv_out: str, estimator_name: str, model_name: str, mse: float | None, snr: float | None, mse_component_wise: ndarray | None, snr_component_wise: ndarray | None, objective: float | None) None[source]

beetroots.inversion.results.utils.regularization_weights module

class beetroots.inversion.results.utils.regularization_weights.ResultsRegularizationWeights(model_name: str, path_img: str, path_data_csv_out_mcmc: str, N_MCMC: int, T_MC: int, T_BI: int, freq_save: int, D_sampling: int, list_names: List[str])[source]

Bases: ResultsUtil

D
N_MCMC
T_BI
T_MC
create_folders()[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_T_BI
effective_T_MC
estimate_regu_weight(list_mcmc_folders: List[str]) ndarray[source]
freq_save
list_names
main(list_mcmc_folders: List[str], list_idx_sampling: List[int]) ndarray[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out_mcmc
path_img
read_data(list_mcmc_folders: List[str])[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.valid_mc module

class beetroots.inversion.results.utils.valid_mc.ResultsValidMC(model_name: str, path_img: str, path_data_csv_out_mcmc: str, N_MCMC: int, T_MC: int, T_BI: int, freq_save: int, N: int, D_sampling: int)[source]

Bases: ResultsUtil

D
N
N_MCMC
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_len_mc
main(list_names: List[str], list_idx_sampling: List[int]) None[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out_mcmc
path_img
read_data() DataFrame[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

beetroots.inversion.results.utils.y_f_Theta module

class beetroots.inversion.results.utils.y_f_Theta.ResultsDistributionComparisonYandFTheta(model_name: str, path_img: str, path_data_csv_out_mcmc: str, N_MCMC: int, T_MC: int, T_BI: int, freq_save: int, N: int, D: int, list_idx_sampling: List[int], max_workers: int)[source]

Bases: ResultsUtil

D
N
N_MCMC
T_BI
T_MC
create_folders() str[source]

create the folder where the specific result is to be saved

Returns:

path to the folder where the specific result is to be saved

Return type:

str

effective_len_mc
freq_save
main(list_mcmc_folders: List[str], scaler: Scaler, forward_map: ForwardMap, y: ndarray, omega: ndarray, sigma_a: ndarray, sigma_m: ndarray, list_lines: List[str], name_list_lines: str, point_challenger: Dict = {}) None[source]

runs the two previous methods and compute the specific result

model_name
path_data_csv_out_mcmc
path_img
read_data() ndarray[source]

read the data necessary for the computation of the specific result of interest

Parameters:

list_chains_folders (List[int]) – list of the paths to the folders containing the raw results

Module contents