mirror of https://github.com/jlizier/jidt
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:
parent
9643b1ce6b
commit
914dc171f5
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue