Bug fix to local TE for spike trains code; forgot to increment the index when computing local values, fixed.

This commit is contained in:
Joseph Lizier 2025-03-28 15:15:30 +11:00
parent efd3943697
commit cab3de8b07
1 changed files with 3 additions and 1 deletions

View File

@ -724,7 +724,7 @@ public class TransferEntropyCalculatorSpikingIntegration implements TransferEntr
* We take the actual joint tree at spikes (along with the associated embeddings) as an argument, as we will need to swap these out when * We take the actual joint tree at spikes (along with the associated embeddings) as an argument, as we will need to swap these out when
* computing surrogates. * computing surrogates.
*/ */
public TERateResults computeAverageLocalOfObservations(KdTree actualKdTreeJointAtSpikes, Vector<double[]> actualJointEmbeddingsFromSpikes) throws Exception { protected TERateResults computeAverageLocalOfObservations(KdTree actualKdTreeJointAtSpikes, Vector<double[]> actualJointEmbeddingsFromSpikes) throws Exception {
double currentSum = 0; double currentSum = 0;
int numTargetSpikesToSkip = MatrixUtils.max(destPastIntervals); int numTargetSpikesToSkip = MatrixUtils.max(destPastIntervals);
@ -855,6 +855,7 @@ public class TransferEntropyCalculatorSpikingIntegration implements TransferEntr
} }
throw new Exception("NaNs in TE clac " + radiusJointSpikes + " " + radiusJointSamples + " " + tempRadiusJointSamples); throw new Exception("NaNs in TE clac " + radiusJointSpikes + " " + radiusJointSamples + " " + tempRadiusJointSamples);
} }
indexInLocals++; // Move to record the next local value
} }
// Normalise by time // Normalise by time
double timeSum = 0; double timeSum = 0;
@ -962,6 +963,7 @@ public class TransferEntropyCalculatorSpikingIntegration implements TransferEntr
return new EmpiricalMeasurementDistribution(surrogateTEValues, estimatedValue); return new EmpiricalMeasurementDistribution(surrogateTEValues, estimatedValue);
} }
// Data structure to return local values from this estimator
public class SpikingTELocalValues implements SpikingLocalInformationValues { public class SpikingTELocalValues implements SpikingLocalInformationValues {
public double[] contributionsAtEachSpike; public double[] contributionsAtEachSpike;