def print_fisher_info(): """Prints Fisher information for logging purposes""" fisher = FisherInformation(data_file, include_nuisance_parameters=False) fisher_obs = fisher_info["observable"] fisher_bins = fisher_info["histogram_bins"] fisher_range = fisher_info["histogram_range"] fisher_theta = fisher_info["theta_true"] info, _ = fisher.full_information( theta=fisher_theta, luminosity=luminosity, model_file=f"{model_dir}/{gen_method}/{gen_method}", ) logger.info(f"Fisher information in rates:") logger.info(f"{info}") info_histo, _ = fisher.histo_information( theta=fisher_theta, luminosity=luminosity, observable=fisher_obs, bins=fisher_bins, histrange=fisher_range, ) logger.info(f"Fisher information in 1D histogram:") logger.info(f"{info_histo}")
def print_fisher_info(): """ Prints Fisher information for logging purposes """ fisher = FisherInformation(data_file, include_nuisance_parameters=False) fisher_obs = fisher_info['observable'] fisher_bins = fisher_info['histogram_bins'] fisher_range = fisher_info['histogram_range'] fisher_theta = fisher_info['theta_true'] info, _ = fisher.full_information( theta=fisher_theta, luminosity=luminosity, model_file=f'{model_dir}/{gen_method}/{gen_method}', ) logger.info(f'Fisher information in rates:') logger.info(f'\n{info}') info_histo, _ = fisher.histo_information( theta=fisher_theta, luminosity=luminosity, observable=fisher_obs, bins=fisher_bins, histrange=fisher_range, ) logger.info(f'Fisher information in 1D histogram:') logger.info(f'\n{info_histo}')
def get_ratio_estimator(estimator_name: str): """ Returns the desired ratio estimator class defined by its string name :param estimator_name: name to identify the desired estimator :return: ConditionalEstimator """ try: estimator_cls = ratio_estimators[estimator_name] except KeyError: logger.info( f"Invalid name: {estimator_name}. Defaulting to Parameterized") estimator_cls = ParameterizedRatioEstimator return estimator_cls
def parse_theta_ranges(): """ Parses the minimum and maximum values for thetas in order to build a theta ranges. :return: list """ ranges = [] for asymp_theta in asymp_info["region"].keys(): ranges.append(( asymp_info["region"][asymp_theta]["min"], asymp_info["region"][asymp_theta]["max"], )) logger.info(f"Theta ranges: {ranges}") return ranges
def parse_theta_ranges(): """ Parses the minimum and maximum values for thetas in order to build a theta ranges. :return: list """ ranges = [] for asymp_theta in asymp_info['region'].keys(): ranges.append(( asymp_info['region'][asymp_theta]['min'], asymp_info['region'][asymp_theta]['max'], )) logger.info(f'Theta ranges: {ranges}') return ranges
############################# sampler = SampleAugmenter(data_file, include_nuisance_parameters=nuisance) ############################# ## Create training samples ## ############################# # Different methods have different arguments train_ratio_methods = {'alice', 'alices', 'cascal', 'carl', 'rolr', 'rascal'} train_local_methods = {'sally', 'sallino'} train_global_methods = {'scandal'} # Iterate through the methods for method in methods: logger.info(f'Sampling from method: {method}') training_params = inputs[method] for i in range(n_sampling_runs): if method in train_ratio_methods: theta_0_spec = training_params['theta_0'] theta_1_spec = training_params['theta_1'] theta_0_vals = get_theta_values(theta_0_spec) theta_1_vals = get_theta_values(theta_1_spec) sampler.sample_train_ratio( theta0=theta_0_vals, theta1=theta_1_vals, n_samples=n_samples_train, folder=f'{data_dir}/Samples_{method}_{i}',
sampler = SampleAugmenter(data_file, include_nuisance_parameters=nuisance) ############################# ## Create training samples ## ############################# # Different methods have different arguments train_ratio_methods = {"alice", "alices", "cascal", "carl", "rolr", "rascal"} train_local_methods = {"sally", "sallino"} train_global_methods = {"scandal"} # Iterate through the methods for method in methods: logger.info(f"Sampling from method: {method}") training_params = inputs[method] for i in range(n_sampling_runs): if method in train_ratio_methods: theta_0_spec = training_params["theta_0"] theta_1_spec = training_params["theta_1"] theta_0_vals = get_theta_values(theta_0_spec) theta_1_vals = get_theta_values(theta_1_spec) sampler.sample_train_ratio( theta0=theta_0_vals, theta1=theta_1_vals, n_samples=n_samples_train, folder=f"{data_dir}/Samples_{method}_{i}",