Added addObservations() method with sourceValid and destValid boolean arrays to TransferEntropyCalculatorViacondMutualInfo class

This commit is contained in:
jlizier 2018-09-21 10:34:01 +10:00
parent 6cf43db7f5
commit 3aa1493d7f
2 changed files with 21 additions and 1 deletions

View File

@ -290,6 +290,7 @@ public abstract class MutualInfoMultiVariateCommon implements
finaliseAddObservations();
}
@Override
public void setObservations(double[] source, double[] destination,
boolean[] sourceValid, boolean[] destValid) throws Exception {

View File

@ -335,13 +335,32 @@ public class TransferEntropyCalculatorViaCondMutualInfo implements
@Override
public void addObservations(double[] source, double[] destination)
throws Exception {
// Store these observations in our vector for now
// Store these observations in our vectors for now
vectorOfSourceTimeSeries.add(source);
vectorOfDestinationTimeSeries.add(destination);
vectorOfValidityOfSource.add(null); // All observations were valid
vectorOfValidityOfDestination.add(null); // All observations were valid
}
/**
* Adds this set of observations to compute the PDFs from, but
* only where these observations are indicated to be valid.
*
* @param source time series of observations for the source variable.
* @param destination time series of observations for the destination variable.
* @param sourceValid array (with indices the same as source) indicating whether the source at that index is valid.
* @param destValid array (with indices the same as destination) indicating whether the destination at that index is valid.
* @throws Exception
*/
public void addObservations(double[] source, double[] destination,
boolean[] sourceValid, boolean[] destValid) throws Exception {
// Store these observations in our vectors for now
vectorOfSourceTimeSeries.add(source);
vectorOfDestinationTimeSeries.add(destination);
vectorOfValidityOfSource.add(sourceValid); // All observations were valid
vectorOfValidityOfDestination.add(destValid); // All observations were valid
}
/**
* Protected method to internally parse and submit observations through
* to the underlying conditional MI calculator once any internal parameter settings