def compute_conf_scores(path): logging.info("Computing confidence scores") job = load_job(path) raw = job.results.raw_stats bins = job.results.bins unperm_counts = cumulative_hist(raw, bins) perm_counts = job.results.bin_to_mean_perm_count bin_to_score = confidence_scores(unperm_counts, perm_counts, np.shape(raw)[-1]) feature_to_score = assign_scores_to_features( raw, bins, bin_to_score) with h5py.File(path, 'r+') as db: db.create_dataset("bin_to_unperm_count", data=unperm_counts) db.create_dataset("bin_to_score", data=bin_to_score) db.create_dataset("feature_to_score", data=feature_to_score)
def compute_conf_scores(path): logging.info("Computing confidence scores") job = load_job(path) raw = job.results.raw_stats bins = job.results.bins unperm_counts = cumulative_hist(raw, bins) perm_counts = job.results.bin_to_mean_perm_count bin_to_score = confidence_scores(unperm_counts, perm_counts, np.shape(raw)[-1]) feature_to_score = assign_scores_to_features(raw, bins, bin_to_score) with h5py.File(path, 'r+') as db: db.create_dataset("bin_to_unperm_count", data=unperm_counts) db.create_dataset("bin_to_score", data=bin_to_score) db.create_dataset("feature_to_score", data=feature_to_score)
def score_dist_by_tuning_param(job_meta, job_db): plt.title('Features by confidence score') plt.xlabel('Confidence') plt.ylabel('Features') lines = [] labels = [] params = job_db.settings.tuning_params if 'tuning_param_idx' in request.args: params = [int(request.args.get('tuning_param_idx'))] for i, alpha in enumerate(params): bins = np.arange(0.5, 1.0, 0.01) hist = cumulative_hist(job_db.results.feature_to_score[i], bins) lines.append(plt.plot(bins[:-1], hist, label=str(alpha))) labels.append(str(alpha)) plt.legend(loc='upper right') return figure_response()
def score_dist_by_tuning_param(job_meta, job_db): plt.title('Features by confidence score') plt.xlabel('Confidence') plt.ylabel('Features') lines = [] labels = [] params = job_db.settings.tuning_params if 'tuning_param_idx' in request.args: params = [ int(request.args.get('tuning_param_idx')) ] for i, alpha in enumerate(params): bins = np.arange(0.5, 1.0, 0.01) hist = cumulative_hist(job_db.results.feature_to_score[i], bins) lines.append(plt.plot(bins[:-1], hist, label=str(alpha))) labels.append(str(alpha)) plt.legend(loc='upper right') return figure_response()