def print_failures(prefix, outfile=sys.stdout): params = load_params(prefix) failures = [] for level in range(1, params.search_depth + 1): ok_counts = collections.defaultdict(int) fail_counts = collections.defaultdict(int) for expt_name in all_experiment_names(prefix): for _, structure in storage.load(experiments.structures_file(expt_name, level)): for split_id in range(params.num_splits): for sample_id in range(params.num_samples): ok = False fname = experiments.scores_file(expt_name, level, structure, split_id, sample_id) if storage.exists(fname): row_loglik, col_loglik = storage.load(fname) if np.all(np.isfinite(row_loglik)) and np.all(np.isfinite(col_loglik)): ok = True if ok: ok_counts[structure] += 1 else: fail_counts[structure] += 1 for structure in fail_counts: if ok_counts[structure] > 0: failures.append(presentation.Failure(structure, level, False)) else: failures.append(presentation.Failure(structure, level, True)) presentation.print_failed_structures(failures, outfile)
def print_failures(prefix, outfile=sys.stdout): params = load_params(prefix) failures = [] for level in range(1, params.search_depth + 1): ok_counts = collections.defaultdict(int) fail_counts = collections.defaultdict(int) for expt_name in all_experiment_names(prefix): for _, structure in storage.load( experiments.structures_file(expt_name, level)): for split_id in range(params.num_splits): for sample_id in range(params.num_samples): ok = False fname = experiments.scores_file( expt_name, level, structure, split_id, sample_id) if storage.exists(fname): row_loglik, col_loglik = storage.load(fname) if np.all(np.isfinite(row_loglik)) and np.all( np.isfinite(col_loglik)): ok = True if ok: ok_counts[structure] += 1 else: fail_counts[structure] += 1 for structure in fail_counts: if ok_counts[structure] > 0: failures.append(presentation.Failure(structure, level, False)) else: failures.append(presentation.Failure(structure, level, True)) presentation.print_failed_structures(failures, outfile)
def print_failures(name, outfile=sys.stdout): params = storage.load(params_file(name)) failures = [] for level in range(1, params.search_depth + 1): for _, structure in storage.load(structures_file(name, level)): total_ok = 0 for split_id in range(params.num_splits): for sample_id in range(params.num_samples): fname = scores_file(name, level, structure, split_id, sample_id) if storage.exists(fname): row_loglik, col_loglik = storage.load(fname) if np.all(np.isfinite(row_loglik)) and np.all(np.isfinite(col_loglik)): total_ok += 1 if total_ok == 0: failures.append(presentation.Failure(structure, level, True)) elif total_ok < params.num_splits * params.num_samples: failures.append(presentation.Failure(structure, level, False)) presentation.print_failed_structures(failures, outfile)