-
Notifications
You must be signed in to change notification settings - Fork 1
negative cross mate correlations break here #18
Copy link
Copy link
Open
Description
When the cross-mate correlation is set to be negative, this line breaks and produces no realized correlation. A simple fix is to correct for the correlation sign:
signal_scale = np.sqrt(abs(R))
noise_scale = np.sqrt(max(0.0, 1 - abs(R)))
sign = 1.0 if R >= 0 else -1.0
mating_score1 = sum_scaled_mate1 * signal_scale + noise_scale * np.random.normal(0, np.std(sum_scaled_mate1), n)
mating_score2 = sign * sum_scaled_mate2 * signal_scale + noise_scale * np.random.normal(0, np.std(sum_scaled_mate2), n)
Lines 872 to 873 in 00080b3
| mating_score1 = sum_scaled_mate1 * np.sqrt(R) + np.sqrt(np.abs(1-R))*np.random.normal(0,np.std(sum_scaled_mate1),n)#sum_scaled_mate1.shape[0]) | |
| mating_score2 = sum_scaled_mate2 * np.sqrt(R) + np.sqrt(np.abs(1-R))*np.random.normal(0,np.std(sum_scaled_mate2),n)#sum_scaled_mate2.shape[0]) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels