From 6ae31c151d7e47e4c63ec2f460426793172c0a1e Mon Sep 17 00:00:00 2001 From: zsloan Date: Mon, 3 May 2021 19:07:53 +0000 Subject: Account for the possibility of the R being returned as 0.999... by scipy when a trait is correlated against itself - before the 0.999... was preventing it from switching to calculating Spearman for the values above the diagonal in the correlation matrix --- wqflask/wqflask/correlation_matrix/show_corr_matrix.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 3a54a218..155b725f 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -40,7 +40,6 @@ from utility.redis_tools import get_redis_conn Redis = get_redis_conn() THIRTY_DAYS = 60 * 60 * 24 * 30 - class CorrelationMatrix: def __init__(self, start_vars): @@ -129,7 +128,7 @@ class CorrelationMatrix: this_trait_vals, target_vals) if is_spearman == False: sample_r, sample_p = pearson_r, pearson_p - if sample_r == 1: + if sample_r > 0.999: is_spearman = True else: sample_r, sample_p = scipy.stats.spearmanr( -- cgit v1.2.3