Appending suffix "Discrete" to all discrete calculators. Step 2 -- refactoring java files, which has flow on effects to other java files. All fixed here.

This commit is contained in:
joseph.lizier 2014-08-14 03:00:15 +00:00
parent 752b2fdb23
commit f2c5ba4771
20 changed files with 115 additions and 113 deletions

View File

@ -18,8 +18,9 @@
package infodynamics.measures.continuous.symbolic;
import infodynamics.measures.continuous.TransferEntropyCalculator;
import infodynamics.measures.continuous.TransferEntropyCommon;
import infodynamics.measures.discrete.TransferEntropyCalculator;
import infodynamics.measures.discrete.TransferEntropyCalculatorDiscrete;
import infodynamics.utils.FirstIndexComparatorDouble;
import infodynamics.utils.MathsUtils;
import infodynamics.utils.MatrixUtils;
@ -68,12 +69,12 @@ import java.util.Vector;
*/
public class TransferEntropyCalculatorSymbolic
extends TransferEntropyCommon
implements infodynamics.measures.continuous.TransferEntropyCalculator {
implements TransferEntropyCalculator {
/**
* The discrete calculator used to do the grunt work
*/
protected TransferEntropyCalculator teCalc;
protected TransferEntropyCalculatorDiscrete teCalc;
protected int maxEmbeddingLength; // = Max(l,k)
// l will default to the value of k unless l gets explicitly set
@ -177,7 +178,7 @@ public class TransferEntropyCalculatorSymbolic
// The discrete calculator only uses a history of 1 here - k is built into
// the permutations
int base = Math.max(destPermutationIds.length, sourcePermutationIds.length);
teCalc = TransferEntropyCalculator.newInstance(base, 1);
teCalc = TransferEntropyCalculatorDiscrete.newInstance(base, 1);
teCalc.initialise();
}

View File

@ -36,7 +36,7 @@ import infodynamics.utils.RandomGenerator;
*
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator: {@link #ActiveInformationCalculator(int, int)};</li>
* <li>Construct the calculator: {@link #ActiveInformationCalculatorDiscrete(int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -68,7 +68,7 @@ import infodynamics.utils.RandomGenerator;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPastCalculator {
public class ActiveInformationCalculatorDiscrete extends SingleAgentMeasureDiscreteInContextOfPastCalculator {
/**
* User was formerly forced to create new instances through this factory method.
@ -79,8 +79,8 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
* @deprecated
* @return
*/
public static ActiveInformationCalculator newInstance(int base, int history) {
return new ActiveInformationCalculator(base, history);
public static ActiveInformationCalculatorDiscrete newInstance(int base, int history) {
return new ActiveInformationCalculatorDiscrete(base, history);
}
/**
@ -91,7 +91,7 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
* @param history embedded history length of the destination to condition on -
* this is k in Schreiber's notation.
*/
public ActiveInformationCalculator(int base, int history) {
public ActiveInformationCalculatorDiscrete(int base, int history) {
super(base, history);
}
@ -336,7 +336,7 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
* Computes local active info storage for the given (single)
* specific values.
*
* See {@link TransferEntropyCalculator#getPastCount(int)} for how the
* See {@link TransferEntropyCalculatorDiscrete#getPastCount(int)} for how the
* joint embedded values representing the past are calculated.
*
* @param next next value of the variable
@ -690,8 +690,8 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
t_next += numberOfSamplesNext;
}
ActiveInformationCalculator ais2;
ais2 = new ActiveInformationCalculator(base, k);
ActiveInformationCalculatorDiscrete ais2;
ais2 = new ActiveInformationCalculatorDiscrete(base, k);
ais2.initialise();
ais2.observations = observations;
ais2.pastCount = pastCount;
@ -764,7 +764,7 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
* combined past values of x up to and including time step t:
* (i.e. (x_{t-k+1}, ... ,x_{t-1},x_{t}))
*
* See {@link TransferEntropyCalculator#getPastCount(int)} for
* See {@link TransferEntropyCalculatorDiscrete#getPastCount(int)} for
* how the joint value representing the past is calculated.
*
* @param x time series
@ -787,7 +787,7 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
* up to and including time step t:
* (i.e. (x_{t-k+1}, ... ,x_{t-1},x_{t}))
*
* See {@link TransferEntropyCalculator#getPastCount(int)} for
* See {@link TransferEntropyCalculatorDiscrete#getPastCount(int)} for
* how the joint value representing the past is calculated.
*
* @param data 2D time series, first index is time,
@ -811,7 +811,7 @@ public class ActiveInformationCalculator extends SingleAgentMeasureInContextOfPa
* up to and including time step t:
* (i.e. (x_{t-k+1}, ... ,x_{t-1},x_{t}))
*
* See {@link TransferEntropyCalculator#getPastCount(int)} for
* See {@link TransferEntropyCalculatorDiscrete#getPastCount(int)} for
* how the joint value representing the past is calculated.
*
* @param data 3D time series, first index is time,

View File

@ -30,7 +30,7 @@ import infodynamics.utils.MatrixUtils;
*
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator: {@link #BlockEntropyCalculator(int, int)};</li>
* <li>Construct the calculator: {@link #BlockEntropyCalculatorDiscrete(int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -60,7 +60,7 @@ Theory' (John Wiley & Sons, New York, 1991).</li>
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class BlockEntropyCalculator extends EntropyCalculator {
public class BlockEntropyCalculatorDiscrete extends EntropyCalculatorDiscrete {
/**
* Number of consecutive time-steps to compute entropy over.
@ -78,8 +78,8 @@ public class BlockEntropyCalculator extends EntropyCalculator {
* @param base
* @deprecated
*/
public static EntropyCalculator newInstance(int blocksize, int base) {
return new BlockEntropyCalculator(blocksize, base);
public static EntropyCalculatorDiscrete newInstance(int blocksize, int base) {
return new BlockEntropyCalculatorDiscrete(blocksize, base);
}
/**
@ -89,7 +89,7 @@ public class BlockEntropyCalculator extends EntropyCalculator {
* @param base number of quantisation levels for each variable.
* E.g. binary variables are in base-2.
*/
public BlockEntropyCalculator(int blocksize, int base) {
public BlockEntropyCalculatorDiscrete(int blocksize, int base) {
super(base);

View File

@ -54,7 +54,7 @@ import infodynamics.utils.EmpiricalMeasurementDistribution;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public interface ChannelCalculator {
public interface ChannelCalculatorDiscrete {
/**
* Initialise the calculator for (re-)use, with the existing

View File

@ -26,19 +26,19 @@ import infodynamics.utils.MatrixUtils;
* entropy rate and entropy.
*
* <p>This class is preliminary, so the Javadocs are incomplete --
* please see {@link ActiveInformationCalculator},
* {@link EntropyRateCalculator} and {@link EntropyCalculator}
* please see {@link ActiveInformationCalculatorDiscrete},
* {@link EntropyRateCalculatorDiscrete} and {@link EntropyCalculatorDiscrete}
* for documentation on the corresponding functions
* and typical usage pattern.
* </p>
*
* TODO Make this inherit from {@link SingleAgentMeasureInContextOfPastCalculator}
* like {@link ActiveInformationCalculator} and fix the Javadocs
* TODO Make this inherit from {@link SingleAgentMeasureDiscreteInContextOfPastCalculator}
* like {@link ActiveInformationCalculatorDiscrete} and fix the Javadocs
*
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class CombinedActiveEntRateCalculator {
public class CombinedActiveEntRateCalculatorDiscrete {
private double averageActive = 0.0;
private double maxActive = 0.0;
@ -71,7 +71,7 @@ public class CombinedActiveEntRateCalculator {
public double[] localEntropy;
}
public CombinedActiveEntRateCalculator() {
public CombinedActiveEntRateCalculatorDiscrete() {
super();
}

View File

@ -31,7 +31,7 @@ import infodynamics.utils.RandomGenerator;
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator:
* {@link #ConditionalMutualInformationCalculator(int, int, int)};</li>
* {@link #ConditionalMutualInformationCalculatorDiscrete(int, int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -63,8 +63,8 @@ Theory' (John Wiley & Sons, New York, 1991).</li>
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class ConditionalMutualInformationCalculator
extends InfoMeasureCalculator implements AnalyticNullDistributionComputer {
public class ConditionalMutualInformationCalculatorDiscrete
extends InfoMeasureCalculatorDiscrete implements AnalyticNullDistributionComputer {
/**
* Store the number of symbols for each variable
@ -92,8 +92,8 @@ public class ConditionalMutualInformationCalculator
* directly.
* @return new calculator object
*/
public static ConditionalMutualInformationCalculator newInstance(int base1, int base2, int condBase) {
return new ConditionalMutualInformationCalculator(base1, base2, condBase);
public static ConditionalMutualInformationCalculatorDiscrete newInstance(int base1, int base2, int condBase) {
return new ConditionalMutualInformationCalculatorDiscrete(base1, base2, condBase);
}
/**
@ -104,7 +104,7 @@ public class ConditionalMutualInformationCalculator
* @param base2 number of symbols for second variable.
* @param condBase number of symbols for conditional variable.
*/
public ConditionalMutualInformationCalculator(int base1, int base2, int condBase) {
public ConditionalMutualInformationCalculatorDiscrete(int base1, int base2, int condBase) {
// Create super object, just with first base
super(base1);
@ -505,8 +505,8 @@ public class ConditionalMutualInformationCalculator
// time series of var1Values, to bootstrap the distribution
// of conditional MI values under the null hypothesis.
ConditionalMutualInformationCalculator condMi2 =
new ConditionalMutualInformationCalculator(base1, base2, condBase);
ConditionalMutualInformationCalculatorDiscrete condMi2 =
new ConditionalMutualInformationCalculatorDiscrete(base1, base2, condBase);
condMi2.initialise();
// Set up the joint counts which remain the same under reordering
// of variable 1:

View File

@ -41,7 +41,7 @@ import infodynamics.utils.RandomGenerator;
* </p>
* <ol>
* <li>Construct the calculator via
* {@link #ConditionalTransferEntropyCalculator(int, int, int)};</li>
* {@link #ConditionalTransferEntropyCalculatorDiscrete(int, int, int)};</li>
* <li>Initialise the calculator using
* {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
@ -105,7 +105,7 @@ import infodynamics.utils.RandomGenerator;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class ConditionalTransferEntropyCalculator extends InfoMeasureCalculator {
public class ConditionalTransferEntropyCalculatorDiscrete extends InfoMeasureCalculatorDiscrete {
protected int k = 0; // history length k.
protected int base_power_k = 0;
@ -133,10 +133,10 @@ public class ConditionalTransferEntropyCalculator extends InfoMeasureCalculator
* @deprecated
* @return
*/
public static ConditionalTransferEntropyCalculator
public static ConditionalTransferEntropyCalculatorDiscrete
newInstance(int base, int history, int numOtherInfoContributors) {
return new ConditionalTransferEntropyCalculator
return new ConditionalTransferEntropyCalculatorDiscrete
(base, history, numOtherInfoContributors);
// Old code for an attempted optimisation:
@ -162,7 +162,7 @@ public class ConditionalTransferEntropyCalculator extends InfoMeasureCalculator
* (other than the past of the destination
* or the source) to condition on.
*/
public ConditionalTransferEntropyCalculator
public ConditionalTransferEntropyCalculatorDiscrete
(int base, int history, int numOtherInfoContributors) {
super(base);
@ -640,7 +640,7 @@ public class ConditionalTransferEntropyCalculator extends InfoMeasureCalculator
// (Not necessary to check for distinct random perturbations)
int[][] newOrderings = rg.generateRandomPerturbations(observations, numPermutationsToCheck);
ConditionalTransferEntropyCalculator cte = newInstance(base, k, numOtherInfoContributors);
ConditionalTransferEntropyCalculatorDiscrete cte = newInstance(base, k, numOtherInfoContributors);
cte.initialise();
cte.observations = observations;
cte.pastOthersCount = pastOthersCount;

View File

@ -26,14 +26,14 @@ import infodynamics.utils.MatrixUtils;
* require knowledge of the embedded past state of a univariate
* discrete (ie int[]) variable.
*
* Usage is as per {@link InfoMeasureCalculator}, but with some
* Usage is as per {@link InfoMeasureCalculatorDiscrete}, but with some
* extra utility functions provided for computing embedding vectors.
*
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public abstract class ContextOfPastMeasureCalculator extends
InfoMeasureCalculator {
public abstract class ContextOfPastMeasureCalculatorDiscrete extends
InfoMeasureCalculatorDiscrete {
/**
* History length for the embedding
@ -72,7 +72,7 @@ public abstract class ContextOfPastMeasureCalculator extends
* E.g. binary variables are in base-2.
* @param history embedding length
*/
public ContextOfPastMeasureCalculator(int base, int history) {
public ContextOfPastMeasureCalculatorDiscrete(int base, int history) {
this(base, history, false);
}
@ -88,7 +88,7 @@ public abstract class ContextOfPastMeasureCalculator extends
* for observations of the embedded past (as the child
* class is signalling that it does not need it)
*/
protected ContextOfPastMeasureCalculator(int base, int history, boolean dontCreateObsStorage) {
protected ContextOfPastMeasureCalculatorDiscrete(int base, int history, boolean dontCreateObsStorage) {
super(base);
k = history;

View File

@ -25,7 +25,7 @@ import infodynamics.utils.MatrixUtils;
*
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator: {@link #EntropyCalculator(int)};</li>
* <li>Construct the calculator: {@link #EntropyCalculatorDiscrete(int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -55,8 +55,8 @@ Theory' (John Wiley & Sons, New York, 1991).</li>
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class EntropyCalculator extends InfoMeasureCalculator
implements SingleAgentMeasure
public class EntropyCalculatorDiscrete extends InfoMeasureCalculatorDiscrete
implements SingleAgentMeasureDiscrete
{
protected int[] stateCount = null; // Count for i[t]
@ -72,15 +72,15 @@ public class EntropyCalculator extends InfoMeasureCalculator
* @deprecated
* @return a new EntropyCalculator
*/
public static EntropyCalculator newInstance(int base, int blocksize) {
public static EntropyCalculatorDiscrete newInstance(int base, int blocksize) {
if (blocksize > 1) {
return BlockEntropyCalculator.newInstance(blocksize, base);
return BlockEntropyCalculatorDiscrete.newInstance(blocksize, base);
} else {
return EntropyCalculator.newInstance(base);
return EntropyCalculatorDiscrete.newInstance(base);
}
}
public static EntropyCalculator newInstance(int base) {
return new EntropyCalculator(base);
public static EntropyCalculatorDiscrete newInstance(int base) {
return new EntropyCalculatorDiscrete(base);
}
/**
@ -89,7 +89,7 @@ public class EntropyCalculator extends InfoMeasureCalculator
* @param base number of quantisation levels for each variable.
* E.g. binary variables are in base-2.
*/
public EntropyCalculator(int base) {
public EntropyCalculatorDiscrete(int base) {
super(base);

View File

@ -28,7 +28,7 @@ package infodynamics.measures.discrete;
*
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator: {@link #EntropyRateCalculator(int, int)};</li>
* <li>Construct the calculator: {@link #EntropyRateCalculatorDiscrete(int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -62,7 +62,7 @@ Theory' (John Wiley & Sons, New York, 1991).</li>
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class EntropyRateCalculator extends SingleAgentMeasureInContextOfPastCalculator {
public class EntropyRateCalculatorDiscrete extends SingleAgentMeasureDiscreteInContextOfPastCalculator {
/**
* User was formerly forced to create new instances through this factory method.
@ -73,8 +73,8 @@ public class EntropyRateCalculator extends SingleAgentMeasureInContextOfPastCalc
* @deprecated
* @return
*/
public static EntropyRateCalculator newInstance(int base, int history) {
return new EntropyRateCalculator(base, history);
public static EntropyRateCalculatorDiscrete newInstance(int base, int history) {
return new EntropyRateCalculatorDiscrete(base, history);
}
/**
@ -85,7 +85,7 @@ public class EntropyRateCalculator extends SingleAgentMeasureInContextOfPastCalc
* @param history embedded history length of the destination to condition on -
* this is k in Schreiber's notation.
*/
public EntropyRateCalculator(int base, int history) {
public EntropyRateCalculatorDiscrete(int base, int history) {
super(base, history);
}

View File

@ -48,7 +48,7 @@ package infodynamics.measures.discrete;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public abstract class InfoMeasureCalculator {
public abstract class InfoMeasureCalculatorDiscrete {
/**
* Last computed average of the measure
@ -103,7 +103,7 @@ public abstract class InfoMeasureCalculator {
* @param base number of quantisation levels for each variable.
* E.g. binary variables are in base-2.
*/
protected InfoMeasureCalculator(int base) {
protected InfoMeasureCalculatorDiscrete(int base) {
this.base = base;
log_base = Math.log(base);

View File

@ -31,7 +31,7 @@ import infodynamics.utils.MatrixUtils;
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator:
* {@link #MultiInformationCalculator(int, int)};</li>
* {@link #MultiInformationCalculatorDiscrete(int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -59,7 +59,7 @@ import infodynamics.utils.MatrixUtils;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class MultiInformationCalculator extends InfoMeasureCalculator {
public class MultiInformationCalculatorDiscrete extends InfoMeasureCalculatorDiscrete {
private int[] jointCount = null; // jointCount[jointState]
private int[][] marginalCounts = null; // marginalCounts[marginalIndex][state]
@ -76,7 +76,7 @@ public class MultiInformationCalculator extends InfoMeasureCalculator {
* @numVars numbers of joint variables that multi-info
* will be computed over.
*/
public MultiInformationCalculator(int base, int numVars) {
public MultiInformationCalculatorDiscrete(int base, int numVars) {
super(base);
this.numVars = numVars;
jointStates = MathsUtils.power(base, numVars);

View File

@ -30,8 +30,8 @@ import infodynamics.utils.RandomGenerator;
*
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator: {@link #MutualInformationCalculator(int)}
* or {@link #MutualInformationCalculator(int, int)};</li>
* <li>Construct the calculator: {@link #MutualInformationCalculatorDiscrete(int)}
* or {@link #MutualInformationCalculatorDiscrete(int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -63,8 +63,8 @@ Theory' (John Wiley & Sons, New York, 1991).</li>
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class MutualInformationCalculator extends InfoMeasureCalculator
implements ChannelCalculator, AnalyticNullDistributionComputer {
public class MutualInformationCalculatorDiscrete extends InfoMeasureCalculatorDiscrete
implements ChannelCalculatorDiscrete, AnalyticNullDistributionComputer {
private int timeDiff = 0;
private int[][] jointCount = null; // Count for (i[t-timeDiff], j[t]) tuples
@ -81,7 +81,7 @@ public class MutualInformationCalculator extends InfoMeasureCalculator
* E.g. binary variables are in base-2.
* @throws Exception
*/
public MutualInformationCalculator(int base) throws Exception {
public MutualInformationCalculatorDiscrete(int base) throws Exception {
this(base, 0);
}
@ -94,7 +94,7 @@ public class MutualInformationCalculator extends InfoMeasureCalculator
* MI for given time series
* @throws Exception when timeDiff < 0
*/
public MutualInformationCalculator(int base, int timeDiff) throws Exception {
public MutualInformationCalculatorDiscrete(int base, int timeDiff) throws Exception {
super(base);
if (timeDiff < 0) {
throw new Exception("timeDiff must be >= 0");
@ -275,9 +275,9 @@ public class MutualInformationCalculator extends InfoMeasureCalculator
t_j += numberOfSamplesJ;
}
MutualInformationCalculator mi2;
MutualInformationCalculatorDiscrete mi2;
try {
mi2 = new MutualInformationCalculator(base, timeDiff);
mi2 = new MutualInformationCalculatorDiscrete(base, timeDiff);
} catch (Exception e) {
// The only possible exception is if timeDiff < 0, which
// it cannot be. Shut down the JVM

View File

@ -41,7 +41,8 @@ import infodynamics.utils.MatrixUtils;
*
* <p>Usage of the class is intended to follow this paradigm:</p>
* <ol>
* <li>Construct the calculator: {@link #PredictiveInformationCalculator(int, int)};</li>
* <li>Construct the calculator:
* {@link #PredictiveInformationCalculatorDiscrete(int, int)};</li>
* <li>Initialise the calculator using {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
* to set up the PDFs, using one or more calls to
@ -62,8 +63,8 @@ import infodynamics.utils.MatrixUtils;
* </li>
* </ol>
*
* <p>TODO Inherit from {@link SingleAgentMeasureInContextOfPastCalculator}
* as {@link ActiveInformationCalculator} does; Tidy up the Javadocs for
* <p>TODO Inherit from {@link SingleAgentMeasureDiscreteInContextOfPastCalculator}
* as {@link ActiveInformationCalculatorDiscrete} does; Tidy up the Javadocs for
* the methods, which are somewhat preliminary</p>
*
* <p><b>References:</b><br/>
@ -81,7 +82,7 @@ import infodynamics.utils.MatrixUtils;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class PredictiveInformationCalculator {
public class PredictiveInformationCalculatorDiscrete {
private double average = 0.0;
private double max = 0.0;
@ -106,8 +107,8 @@ public class PredictiveInformationCalculator {
* @deprecated
* @return
*/
public static PredictiveInformationCalculator newInstance(int numDiscreteValues, int blockLength) {
return new PredictiveInformationCalculator(numDiscreteValues, blockLength);
public static PredictiveInformationCalculatorDiscrete newInstance(int numDiscreteValues, int blockLength) {
return new PredictiveInformationCalculatorDiscrete(numDiscreteValues, blockLength);
}
/**
@ -118,7 +119,7 @@ public class PredictiveInformationCalculator {
* @param blockLength embedded history length of the past and future to use -
* this is k in Schreiber's notation.
*/
public PredictiveInformationCalculator(int numDiscreteValues, int blockLength) {
public PredictiveInformationCalculatorDiscrete(int numDiscreteValues, int blockLength) {
super();
this.numDiscreteValues = numDiscreteValues;

View File

@ -35,7 +35,7 @@ import java.util.Properties;
* </p>
* <ol>
* <li>Construct the calculator via
* {@link #SeparableInfoCalculator(int, int, int)};</li>
* {@link #SeparableInfoCalculatorDiscrete(int, int, int)};</li>
* <li>Initialise the calculator using
* {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
@ -73,7 +73,7 @@ import java.util.Properties;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public class SeparableInfoCalculator extends ContextOfPastMeasureCalculator {
public class SeparableInfoCalculatorDiscrete extends ContextOfPastMeasureCalculatorDiscrete {
protected int numSources = 0;
protected int base_power_sources = 0;
@ -117,7 +117,7 @@ public class SeparableInfoCalculator extends ContextOfPastMeasureCalculator {
*
* @return
*/
public static SeparableInfoCalculator
public static SeparableInfoCalculatorDiscrete
newInstance(int base, int history, int numInfoContributors) {
if (history < 1) {
@ -131,10 +131,10 @@ public class SeparableInfoCalculator extends ContextOfPastMeasureCalculator {
if (!FORCE_DIRECT_CALC &&
(MathsUtils.power(base,numInfoContributors + history + 1)
> MAX_CONFIGS_FOR_DIRECT_CALC)) {
return new SeparableInfoCalculatorByAddition
return new SeparableInfoDiscreteCalculatorByAddition
(base, history, numInfoContributors);
} else {
return new SeparableInfoCalculator
return new SeparableInfoCalculatorDiscrete
(base, history, numInfoContributors);
}
}
@ -150,7 +150,7 @@ public class SeparableInfoCalculator extends ContextOfPastMeasureCalculator {
* (other than the past of the destination
* or the source) to condition on.
*/
public SeparableInfoCalculator
public SeparableInfoCalculatorDiscrete
(int base, int history, int numInfoContributors) {
this(base, history, numInfoContributors, false);
}
@ -168,7 +168,7 @@ public class SeparableInfoCalculator extends ContextOfPastMeasureCalculator {
* @param dontCreateObsStorage indicates that storage for
* observations should not be created.
*/
protected SeparableInfoCalculator
protected SeparableInfoCalculatorDiscrete
(int base, int history, int numInfoContributors, boolean dontCreateObsStorage) {
super(base, history, dontCreateObsStorage);

View File

@ -25,7 +25,7 @@ package infodynamics.measures.discrete;
* adding observations and calculating
* local and average values, etc.
*
* <p>Usage is as per {@link InfoMeasureCalculator}, with
* <p>Usage is as per {@link InfoMeasureCalculatorDiscrete}, with
* many methods for supplying observations and making
* calculations defined here.</p>
*
@ -34,13 +34,13 @@ package infodynamics.measures.discrete;
* ContextOfPastCalculator, and since java doesn't allow multiple
* inheritance, one of them has to miss out.
* To get around this, we combine the two in
* {@link SingleAgentMeasureInContextOfPastCalculator}.
* {@link SingleAgentMeasureDiscreteInContextOfPastCalculator}.
* </p>
*
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public interface SingleAgentMeasure {
public interface SingleAgentMeasureDiscrete {
/**
* Add observations in to our estimates of the pdfs.

View File

@ -25,13 +25,13 @@ package infodynamics.measures.discrete;
* discrete (ie int[]) variable.
*
* <p>This combines functionality for single agents from
* {@link SingleAgentMeasure} with functionality
* {@link SingleAgentMeasureDiscrete} with functionality
* required in the context of the past provided by
* {@link ContextOfPastMeasureCalculator}.</p>
* {@link ContextOfPastMeasureCalculatorDiscrete}.</p>
*
* <p>Usage is as defined in {@link InfoMeasureCalculator}, with
* <p>Usage is as defined in {@link InfoMeasureCalculatorDiscrete}, with
* extra methods for supplying observations and making
* calculations defined in {@link SingleAgentMeasure}</p>.
* calculations defined in {@link SingleAgentMeasureDiscrete}</p>.
*
* <p>Users should not need to deal with this class directly;
* it is simply used to gather common functionality for several
@ -43,8 +43,8 @@ package infodynamics.measures.discrete;
* @author Joseph Lizier (<a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>)
*/
public abstract class SingleAgentMeasureInContextOfPastCalculator extends
ContextOfPastMeasureCalculator implements SingleAgentMeasure {
public abstract class SingleAgentMeasureDiscreteInContextOfPastCalculator extends
ContextOfPastMeasureCalculatorDiscrete implements SingleAgentMeasureDiscrete {
/**
* Construct the calculator
@ -53,7 +53,7 @@ public abstract class SingleAgentMeasureInContextOfPastCalculator extends
* E.g. binary variables are in base-2.
* @param history embedding length
*/
public SingleAgentMeasureInContextOfPastCalculator(int base, int history) {
public SingleAgentMeasureDiscreteInContextOfPastCalculator(int base, int history) {
super(base, history);
}

View File

@ -43,8 +43,8 @@ import infodynamics.utils.RandomGenerator;
* Usage of the child classes implementing this interface is intended to follow this paradigm:
* </p>
* <ol>
* <li>Construct the calculator via {@link #TransferEntropyCalculator(int, int)}
* or {@link #TransferEntropyCalculator(int, int, int)};</li>
* <li>Construct the calculator via {@link #TransferEntropyCalculatorDiscrete(int, int)}
* or {@link #TransferEntropyCalculatorDiscrete(int, int, int)};</li>
* <li>Initialise the calculator using
* {@link #initialise()};</li>
* <li>Provide the observations/samples for the calculator
@ -87,8 +87,8 @@ import infodynamics.utils.RandomGenerator;
* @author Joseph Lizier, <a href="joseph.lizier at gmail.com">email</a>,
* <a href="http://lizier.me/joseph/">www</a>
*/
public class TransferEntropyCalculator extends ContextOfPastMeasureCalculator
implements ChannelCalculator, AnalyticNullDistributionComputer {
public class TransferEntropyCalculatorDiscrete extends ContextOfPastMeasureCalculatorDiscrete
implements ChannelCalculatorDiscrete, AnalyticNullDistributionComputer {
/**
* Counts of (source,dest_next,dest_embedded_past) tuples
@ -143,9 +143,9 @@ public class TransferEntropyCalculator extends ContextOfPastMeasureCalculator
* @return a new TransferEntropyCalculator object
* @deprecated
*/
public static TransferEntropyCalculator newInstance(int base, int destHistoryEmbedLength) {
public static TransferEntropyCalculatorDiscrete newInstance(int base, int destHistoryEmbedLength) {
return new TransferEntropyCalculator(base, destHistoryEmbedLength);
return new TransferEntropyCalculatorDiscrete(base, destHistoryEmbedLength);
// Old code for an attempted optimisation:
/*
@ -165,7 +165,7 @@ public class TransferEntropyCalculator extends ContextOfPastMeasureCalculator
* @param destHistoryEmbedLength embedded history length of the destination to condition on -
* this is k in Schreiber's notation.
*/
public TransferEntropyCalculator(int base, int destHistoryEmbedLength) {
public TransferEntropyCalculatorDiscrete(int base, int destHistoryEmbedLength) {
super(base, destHistoryEmbedLength);
base_power_l = MathsUtils.power(base, sourceHistoryEmbedLength);
@ -196,7 +196,7 @@ public class TransferEntropyCalculator extends ContextOfPastMeasureCalculator
* @param sourceHistoryEmbeddingLength embedded history length of the source to include -
* this is l in Schreiber's notation.
*/
public TransferEntropyCalculator(int base, int destHistoryEmbedLength, int sourceHistoryEmbeddingLength) {
public TransferEntropyCalculatorDiscrete(int base, int destHistoryEmbedLength, int sourceHistoryEmbeddingLength) {
super(base, destHistoryEmbedLength);
this.sourceHistoryEmbedLength = sourceHistoryEmbeddingLength;
@ -910,7 +910,7 @@ public class TransferEntropyCalculator extends ContextOfPastMeasureCalculator
* Returns the average active information storage from
* the observed values which have been passed in previously.
*
* @see ActiveInformationCalculator
* @see ActiveInformationCalculatorDiscrete
*/
public double computeAverageActiveInfoStorageOfObservations() {
double active = 0.0;
@ -1003,7 +1003,7 @@ public class TransferEntropyCalculator extends ContextOfPastMeasureCalculator
// of resources here, but there's not much other choice. A better solution
// will come when we switch to an underlying conditional MI calculator, with separate
// bases for each variable, and just use its computeSignificance() method.
TransferEntropyCalculator ate2 = new TransferEntropyCalculator(base_power_l, k, 1);
TransferEntropyCalculatorDiscrete ate2 = new TransferEntropyCalculatorDiscrete(base_power_l, k, 1);
ate2.initialise();
ate2.observations = observations;
ate2.pastCount = pastCount;

View File

@ -20,7 +20,7 @@ package infodynamics.measures.mixed.symbolic;
import infodynamics.measures.mixed.ConditionalMutualInfoCalculatorMultiVariateWithDiscrete;
import infodynamics.measures.continuous.ConditionalMutualInfoCalculatorMultiVariate;
import infodynamics.measures.discrete.ConditionalMutualInformationCalculator;
import infodynamics.measures.discrete.ConditionalMutualInformationCalculatorDiscrete;
import infodynamics.utils.FirstIndexComparatorDouble;
import infodynamics.utils.MathsUtils;
import infodynamics.utils.MatrixUtils;
@ -40,7 +40,7 @@ public class ConditionalMutualInfoCalculatorMultiVariateWithDiscreteSymbolic imp
ConditionalMutualInfoCalculatorMultiVariateWithDiscrete {
// The calculator used to do the grunt work
protected ConditionalMutualInformationCalculator condMiCalc;
protected ConditionalMutualInformationCalculatorDiscrete condMiCalc;
protected int dimensions;
@ -84,7 +84,7 @@ public class ConditionalMutualInfoCalculatorMultiVariateWithDiscreteSymbolic imp
idToPermutationIndex[permutationIds[idIndex]] = idIndex;
}
condMiCalc = ConditionalMutualInformationCalculator.newInstance(permutationIds.length, base, condBase);
condMiCalc = ConditionalMutualInformationCalculatorDiscrete.newInstance(permutationIds.length, base, condBase);
condMiCalc.initialise();
}

View File

@ -20,7 +20,7 @@ package infodynamics.measures.mixed.symbolic;
import infodynamics.measures.mixed.MutualInfoCalculatorMultiVariateWithDiscrete;
import infodynamics.measures.continuous.MutualInfoCalculatorMultiVariate;
import infodynamics.measures.discrete.MutualInformationCalculator;
import infodynamics.measures.discrete.MutualInformationCalculatorDiscrete;
import infodynamics.utils.FirstIndexComparatorDouble;
import infodynamics.utils.MathsUtils;
import infodynamics.utils.MatrixUtils;
@ -40,7 +40,7 @@ public class MutualInfoCalculatorMultiVariateWithDiscreteSymbolic implements
MutualInfoCalculatorMultiVariateWithDiscrete {
// The calculator used to do the grunt work
protected MutualInformationCalculator miCalc;
protected MutualInformationCalculatorDiscrete miCalc;
protected int dimensions;
@ -92,7 +92,7 @@ public class MutualInfoCalculatorMultiVariateWithDiscreteSymbolic implements
// Make the base the maximum of the number of combinations of orderings of the
// continuous variables and the discrete base.
miCalc = new MutualInformationCalculator(baseToUse,0);
miCalc = new MutualInformationCalculatorDiscrete(baseToUse,0);
miCalc.initialise();
}