From 0e40ec2401ea9cd7d08d6eb69db65adf58d92dd2 Mon Sep 17 00:00:00 2001 From: jlizier Date: Wed, 23 Aug 2017 00:18:41 +1000 Subject: [PATCH] Initialising conditional TE calculator to have one conditional dimension by default instead of none. Also fixing the way the conditional parameters are printed via getProperty() when they are null. --- ...ferEntropyCalculatorViaCondMutualInfo.java | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/java/source/infodynamics/measures/continuous/ConditionalTransferEntropyCalculatorViaCondMutualInfo.java b/java/source/infodynamics/measures/continuous/ConditionalTransferEntropyCalculatorViaCondMutualInfo.java index d49faa3..acb7bf5 100755 --- a/java/source/infodynamics/measures/continuous/ConditionalTransferEntropyCalculatorViaCondMutualInfo.java +++ b/java/source/infodynamics/measures/continuous/ConditionalTransferEntropyCalculatorViaCondMutualInfo.java @@ -98,17 +98,17 @@ public class ConditionalTransferEntropyCalculatorViaCondMutualInfo implements * Array of embedding lengths for each conditional variable. * Can be an empty array or null if there are no conditional variables. */ - protected int[] condEmbedDims = null; + protected int[] condEmbedDims = new int[] {1}; /** * Array of embedding delays for the conditional variables. * Must be same length as condEmbedDims array. */ - protected int[] cond_taus = null; + protected int[] cond_taus = new int[] {1}; /** * Array of time lags between last element of each conditional variable * and destination next value. */ - protected int[] condDelays = null; + protected int[] condDelays = new int[] {1}; /** * Time index of the last point in the destination embedding of the first @@ -380,11 +380,23 @@ public class ConditionalTransferEntropyCalculatorViaCondMutualInfo implements } else if (propertyName.equalsIgnoreCase(DELAY_PROP_NAME)) { return Integer.toString(delay); } else if (propertyName.equalsIgnoreCase(COND_EMBED_LENGTHS_PROP_NAME)) { - return MatrixUtils.arrayToString(condEmbedDims); + if (condEmbedDims == null) { + return ""; + } else { + return MatrixUtils.arrayToString(condEmbedDims); + } } else if (propertyName.equalsIgnoreCase(COND_EMBED_DELAYS_PROP_NAME)) { - return MatrixUtils.arrayToString(cond_taus); + if (cond_taus == null) { + return ""; + } else { + return MatrixUtils.arrayToString(cond_taus); + } } else if (propertyName.equalsIgnoreCase(COND_DELAYS_PROP_NAME)) { - return MatrixUtils.arrayToString(condDelays); + if (condDelays == null) { + return ""; + } else { + return MatrixUtils.arrayToString(condDelays); + } } else { // No property matches for this class, assume it is for the underlying // conditional MI calculator