Class MinimaxGroupCache

java.lang.Object
edu.cmu.tetrad.search.utils.MinimaxGroupCache

public final class MinimaxGroupCache extends Object
Cache for quantile-grid binning groups used by minimax-style conditional independence tests/scores.

Groups are keyed by:

  • conditioning set indices zIdx (copied defensively)
  • a signature of the active row list useRows
  • binsPerDim
  • minBinSize

The cached value is an int[][] of groups, where each group is an array of local indices in the 0..n-1 space of useRows (matching MinimaxBinning.computeGroups(DataSet, int[], List, int, int)).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for the MinimaxGroupCache class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the cached groups stored in the internal cache.
    int[][]
    getGroups(DataSet data, int[] zIdx, List<Integer> useRows, int binsPerDim, int minBinSize)
    Computes and returns a group of bins based on the input data and parameters.
    int[][]
    getGroups(DataSet data, int[] zIdx, List<Integer> useRows, MinimaxBinningConfig cfg)
    Computes and returns groups of data indices based on the input dataset, feature indices, rows to include, and binning configuration.
    static long
    Computes a signature for a list of integers based on the FNV-1a hashing algorithm.
    int
    Retrieves the number of cached groups present in the internal cache.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MinimaxGroupCache

      public MinimaxGroupCache()
      Default constructor for the MinimaxGroupCache class. Initializes an instance of the MinimaxGroupCache, providing the structure to store and manage cached group data utilized in binning and grouping operations. This constructor does not perform any specific initialization steps beyond preparing the object for use.
  • Method Details

    • getGroups

      public int[][] getGroups(DataSet data, int[] zIdx, List<Integer> useRows, MinimaxBinningConfig cfg)
      Computes and returns groups of data indices based on the input dataset, feature indices, rows to include, and binning configuration. This method utilizes the binning strategy defined in the MinimaxBinningConfig object to determine the grouping.
      Parameters:
      data - the dataset used for grouping; must not be null
      zIdx - an array of feature indices defining the dimensions used for grouping; must not be null
      useRows - a list of row indices that specifies which rows to include in the grouping; must not be null
      cfg - the configuration object that specifies the binning parameters, including the number of bins per dimension and the minimum bin size; must not be null
      Returns:
      a 2D array of integers where each inner array represents a group of data indices based on the binning configuration
    • getGroups

      public int[][] getGroups(DataSet data, int[] zIdx, List<Integer> useRows, int binsPerDim, int minBinSize)
      Computes and returns a group of bins based on the input data and parameters. If the groups for the given configuration are already cached, it retrieves them from the cache; otherwise, it computes them and stores the result in the cache.
      Parameters:
      data - the dataset used for grouping; must not be null
      zIdx - the array of indices defining the features or dimensions used for grouping; must not be null
      useRows - the list of row indices to use for group computation; must not be null
      binsPerDim - the number of bins to use per dimension in the grouping
      minBinSize - the minimum size of each bin
      Returns:
      a 2D array of integers representing the grouped data where each inner array corresponds to a group of data indices based on the binning configuration
    • clear

      public void clear()
      Clears the cached groups stored in the internal cache. This method removes all previously computed and stored group data, ensuring that the cache is empty and ready for new data to be added.
    • size

      public int size()
      Retrieves the number of cached groups present in the internal cache. This method allows checking how many group entries are currently stored.
      Returns:
      the number of cached groups stored in the internal cache
    • rowsSignature

      public static long rowsSignature(List<Integer> rows)
      Computes a signature for a list of integers based on the FNV-1a hashing algorithm. This method is typically used to generate a deterministic hash for the row indices in order to facilitate caching or comparisons in data processing tasks.
      Parameters:
      rows - the list of integer row indices for which the signature is computed
      Returns:
      a 64-bit hash signature representing the input list of integers