fix bugs where shuffle and rotate strategy where switched

Also fixed rotate surrogate selection, list was being rotate continuously rather than rotating the initial index list, which nullified the dyncorrexcl setting.
This commit is contained in:
Donovan Rynne 2024-05-18 14:24:22 +10:00
parent 9643b1ce6b
commit 914dc171f5
2 changed files with 6 additions and 4 deletions

View File

@ -684,7 +684,7 @@ public abstract class MutualInfoMultiVariateCommon implements
// (Not necessary to check for distinct random perturbations)
int[][] newOrderings = new int[numSurrogatesToCheck][sourceObservations.length];
if (surrogate_type.equalsIgnoreCase(PROP_SHUFFLE)){
if (surrogate_type.equalsIgnoreCase(PROP_ROTATE)){
newOrderings = rg.generateRotatedSurrogates(sourceObservations.length, numSurrogatesToCheck, dynCorrExclTime);
} else {
newOrderings = rg.generateRandomPerturbations(sourceObservations.length, numSurrogatesToCheck);

View File

@ -680,12 +680,14 @@ public class RandomGenerator {
list.add(i);
}
for (int s = 0; s < numberOfRotations; s++) {
// Create a copy of the original list of indices
ArrayList<Integer> rotatedList = new ArrayList<Integer>(list);
// Perform linear time rotations
// Note: the rotations are all equal likelihood, no exclusion window for autocorrelation time
// ignore rotations that are -+ dynCorrExclTime
int rotationAmount = random.nextInt(n - 2 * dynCorrExclTime) + dynCorrExclTime;
Collections.rotate(list, rotationAmount);
Collections.rotate(rotatedList, rotationAmount);
for (int j = 0; j < n; j++) {
sets[s][j] = list.get(j);
sets[s][j] = rotatedList.get(j);
}
}
return sets;