Documentation of 'jhplot.stat.ProbabilityState' Java class.
ProbabilityState
jhplot.stat

Class ProbabilityState



  • public class ProbabilityState
    extends java.lang.Object
    Calculates the probabilities of each state in a random variable. Provides the base for all functions of one variable. Additional functions include the normaliseArrays function which converts all inputs so they start at 0, and the mergeArrays function which creates an array of the joint state of the two input arrays.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      int maxState 
      java.util.HashMap<java.lang.Integer,java.lang.Double> probMap 
    • Constructor Summary

      Constructors 
      Constructor and Description
      ProbabilityState(double[] dataVector)
      Constructor for the ProbabilityState class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int mergeArrays(double[] firstVector, double[] secondVector, double[] outputVector)
      Takes in two arrays and writes the joint state of those arrays to the output vector, returning the maximum joint state.
      static int normaliseArray(double[] inputVector, int[] outputVector)
      Takes an input vector and writes an output vector which is a normalised version of the input, and returns the maximum state.
      static void printDoubleVector(double[] vector)
      A helper function which prints out any given double vector.
      static void printIntVector(int[] vector)
      A helper function which prints out any given int vector.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • probMap

        public final java.util.HashMap<java.lang.Integer,java.lang.Double> probMap
      • maxState

        public final int maxState
    • Constructor Detail

      • ProbabilityState

        public ProbabilityState(double[] dataVector)
        Constructor for the ProbabilityState class. Takes a data vector and calculates the marginal probability of each state, storing each state/probability pair in a HashMap.
        Parameters:
        dataVector - Input vector. It is discretised to the floor of each value.
    • Method Detail

      • normaliseArray

        public static final int normaliseArray(double[] inputVector,
                                               int[] outputVector)
        Takes an input vector and writes an output vector which is a normalised version of the input, and returns the maximum state. A normalised array has min value = 0, max value = old max value - min value and all values are integers The length of the vectors must be the same, and outputVector must be instantiated before calling this function.
        Parameters:
        inputVector - The vector to normalise.
        outputVector - The normalised vector. Must be instantiated to length inputVector.length.
        Returns:
        The maximum state from the normalised vector.
      • mergeArrays

        public static final int mergeArrays(double[] firstVector,
                                            double[] secondVector,
                                            double[] outputVector)
        Takes in two arrays and writes the joint state of those arrays to the output vector, returning the maximum joint state. The length of all vectors must be equal to firstVector.length outputVector must be instantiated before calling this function.
        Parameters:
        firstVector - The first vector.
        secondVector - The second vector.
        outputVector - The merged vector. Must be instantiated to length inputVector.length.
        Returns:
        The maximum state from the merged vector.
      • printIntVector

        public static void printIntVector(int[] vector)
        A helper function which prints out any given int vector. Mainly used to help debug the rest of the toolbox.
        Parameters:
        vector - The vector to print out.
      • printDoubleVector

        public static void printDoubleVector(double[] vector)
        A helper function which prints out any given double vector. Mainly used to help debug the rest of the toolbox.
        Parameters:
        vector - The vector to print out.

DMelt 3.0 © DataMelt by jWork.ORG