Package coconad

Class JNICoCo

java.lang.Object
coconad.JNICoCo

public class JNICoCo extends Object
Class for Java interface to CoCoNAD implementation in C
Since:
2013.11.21
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    target pattern subtype: all frequent patterns
    static final int
    target pattern subtype flag: closed/maximal w.r.t.
    static final int
    algorithm variant: automatic choice based on target type
    static final int
    algorithm variant: basic version (low memory consumption, slow)
    static final int
    surrogate method: dithered blocked permutation
    static final int
    target pattern subtype: all closed (frequent) patterns
    static final int
    algorithm variant: refined version (closed/maximal repository)
    static final int
    pattern set reduction: excess coincidences (zb,cb-ca)
    static final int
    pattern set reduction: excess coincidences (zb,cb-ca+1)
    static final String
    pattern spectrum report format: columns
    static final int
    pattern set reduction: covered points/spikes za*ca : zb*cb
    static final int
    pattern set reduction: covered points/spikes (za-1)*ca : (zb-1)*cb
    static final int
    surrogate method: point/spike dithering/displacement
    static final int
    algorithm variant: refined version (spike and train filtering)
    static final int
    target pattern subtype: all frequent patterns
    static final int
    random number density function: Gaussian (identical to NORMAL
    static final int
    surrogate method: identity (keep original data)
    static final int
    pattern set reduction: excess items/neurons (za-zb+2,ca)
    static final int
    target pattern type: item sets
    static final int
    pattern set reduction: none (keep all patterns after filtering)
    static final int
    surrogate method: sampling from kernel estimate
    static final int
    pattern set reduction: combined lenient (z, break rejection tie)
    static final int
    pattern set reduction: combined lenient (z-1, break rejection tie)
    static final int
    target pattern subtype: all maximal (frequent) patterns
    static final int
    processing mode: no special flags
    static final int
    processing mode: do not use perfect extension pruning
    static final int
    random number density function: normal (identical to GAUSS
    static final int
    processing mode: do not reorder trains by their length
    static final String
    pattern spectrum report format: objects
    static final int
    target pattern type: partial permutations (without repetitions)
    static final int
    surrogate method: dithered point/spike permutation
    static final int
    surrogate method: point/spike time rendomization
    static final int
    random number density function: rectangular (identical to UNIFORM
    static final int
    algorithm variant: refined version (closed/maximal repository)
    static final int
    processing mode: repository is a chain of prefix trees
    static final int
    processing mode: repository is a list/an array
    static final int
    processing mode: repository is a single prefix trees
    static final int
    target pattern type: sequences (with and without repetitions)
    static final int
    surrogate method: train shifting/dithering
    static final int
    pattern set reduction: combined strict (z, force decision)
    static final int
    pattern set reduction: combined strict (z-1, force decision)
    static final int
    target pattern subtype mask
    static final int
    random number density function: triangular
    static final int
    target pattern type mask
    static final int
    random number density function: uniform (identical to RECT
    static final String
    the version string
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    abort(int state)
    Set the abort state (abort computations or clear abort state).
    static Object[]
    coconad(double[][] trains, int target, double width, int supp, int zmin, int zmax, String report, int algo, int mode, int[] border)
    Java interface to CoCoNAD implementation in C.
    static fim.PatternSet
    coconad(TrainSet trains, int target, double width, int supp, int zmin, int zmax, int algo, int mode, int[] border)
    Java interface to CoCoNAD implementation in C (wrapper with Java objects).
    static Object[]
    estpsp(double[][] trains, int target, double width, int supp, int zmin, int zmax, String report, int equiv, double alpha, int smpls, int seed)
    Estimate a pattern spectrum from data characteristics.
    static fim.PatSpecElem[]
    estpsp(TrainSet trains, int target, double width, int supp, int zmin, int zmax, int equiv, double alpha, int smpls, int seed)
    Estimate a pattern spectrum from data characteristics (wrapper with Java objects).
    static Object[]
    genpsp(double[][] trains, int target, double width, int supp, int zmin, int zmax, String report, int algo, int mode, int cnt, double beg, double end, int surr, int rand, double sigma, double delta, int seed, int cpus, int[] ctrl)
    Pattern spectrum generation with surrogate data sets.
    static fim.PatSpecElem[]
    genpsp(TrainSet trains, int target, double width, int supp, int zmin, int zmax, int algo, int mode, int cnt, double beg, double end, int surr, int rand, double sigma, double delta, int seed, int cpus, int[] ctrl)
    Pattern spectrum generation with surrogate data sets (wrapper with java objects).
    static void
    main(String[] args)
    Main program for testing.
    static fim.PatternSet
    patred(fim.PatternSet pats, int method, int[] border, boolean addis)
    Reduce a pattern set.
    static Object[]
    patred(Object[] pats, int method, int[] border, boolean addis)
    Reduce a pattern set.
    static int[]
    psp2bdr(fim.PatSpecElem[] psp)
    Extract decision border from pattern spectrum.
    static int[]
    psp2bdr(Object[] psp)
    Extract decision border from pattern spectrum.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • VERSION

      public static final String VERSION
      the version string
      See Also:
    • SUBMASK

      public static final int SUBMASK
      target pattern subtype mask
      See Also:
    • TYPEMASK

      public static final int TYPEMASK
      target pattern type mask
      See Also:
    • ITEMSET

      public static final int ITEMSET
      target pattern type: item sets
      See Also:
    • PERMUTATION

      public static final int PERMUTATION
      target pattern type: partial permutations (without repetitions)
      See Also:
    • SEQUENCE

      public static final int SEQUENCE
      target pattern type: sequences (with and without repetitions)
      See Also:
    • FREQUENT

      public static final int FREQUENT
      target pattern subtype: all frequent patterns
      See Also:
    • ALL

      public static final int ALL
      target pattern subtype: all frequent patterns
      See Also:
    • CLOSED

      public static final int CLOSED
      target pattern subtype: all closed (frequent) patterns
      See Also:
    • MAXIMAL

      public static final int MAXIMAL
      target pattern subtype: all maximal (frequent) patterns
      See Also:
    • APPEND

      public static final int APPEND
      target pattern subtype flag: closed/maximal w.r.t. appending
      See Also:
    • AUTO

      public static final int AUTO
      algorithm variant: automatic choice based on target type
      See Also:
    • BASIC

      public static final int BASIC
      algorithm variant: basic version (low memory consumption, slow)
      See Also:
    • FILTER

      public static final int FILTER
      algorithm variant: refined version (spike and train filtering)
      See Also:
    • CMREPO

      public static final int CMREPO
      algorithm variant: refined version (closed/maximal repository)
      See Also:
    • REPO

      public static final int REPO
      algorithm variant: refined version (closed/maximal repository)
      See Also:
    • NONE

      public static final int NONE
      processing mode: no special flags
      See Also:
    • NOPERFECT

      public static final int NOPERFECT
      processing mode: do not use perfect extension pruning
      See Also:
    • NOSORT

      public static final int NOSORT
      processing mode: do not reorder trains by their length
      See Also:
    • REPOCHAIN

      public static final int REPOCHAIN
      processing mode: repository is a chain of prefix trees
      See Also:
    • REPOTREE

      public static final int REPOTREE
      processing mode: repository is a single prefix trees
      See Also:
    • REPOLIST

      public static final int REPOLIST
      processing mode: repository is a list/an array
      See Also:
    • IDENTITY

      public static final int IDENTITY
      surrogate method: identity (keep original data)
      See Also:
    • RANDOM

      public static final int RANDOM
      surrogate method: point/spike time rendomization
      See Also:
    • DITHER

      public static final int DITHER
      surrogate method: point/spike dithering/displacement
      See Also:
    • SHIFT

      public static final int SHIFT
      surrogate method: train shifting/dithering
      See Also:
    • KERNEST

      public static final int KERNEST
      surrogate method: sampling from kernel estimate
      See Also:
    • PERMUTE

      public static final int PERMUTE
      surrogate method: dithered point/spike permutation
      See Also:
    • BLOCK

      public static final int BLOCK
      surrogate method: dithered blocked permutation
      See Also:
    • UNIFORM

      public static final int UNIFORM
      random number density function: uniform (identical to RECT
      See Also:
    • RECT

      public static final int RECT
      random number density function: rectangular (identical to UNIFORM
      See Also:
    • TRIANG

      public static final int TRIANG
      random number density function: triangular
      See Also:
    • GAUSS

      public static final int GAUSS
      random number density function: Gaussian (identical to NORMAL
      See Also:
    • NORMAL

      public static final int NORMAL
      random number density function: normal (identical to GAUSS
      See Also:
    • OBJECTS

      public static final String OBJECTS
      pattern spectrum report format: objects
      See Also:
    • COLUMNS

      public static final String COLUMNS
      pattern spectrum report format: columns
      See Also:
    • KEEP

      public static final int KEEP
      pattern set reduction: none (keep all patterns after filtering)
      See Also:
    • COINS0

      public static final int COINS0
      pattern set reduction: excess coincidences (zb,cb-ca)
      See Also:
    • COINS1

      public static final int COINS1
      pattern set reduction: excess coincidences (zb,cb-ca+1)
      See Also:
    • ITEMS2

      public static final int ITEMS2
      pattern set reduction: excess items/neurons (za-zb+2,ca)
      See Also:
    • COVER0

      public static final int COVER0
      pattern set reduction: covered points/spikes za*ca : zb*cb
      See Also:
    • COVER1

      public static final int COVER1
      pattern set reduction: covered points/spikes (za-1)*ca : (zb-1)*cb
      See Also:
    • LENIENT0

      public static final int LENIENT0
      pattern set reduction: combined lenient (z, break rejection tie)
      See Also:
    • LENIENT1

      public static final int LENIENT1
      pattern set reduction: combined lenient (z-1, break rejection tie)
      See Also:
    • STRICT0

      public static final int STRICT0
      pattern set reduction: combined strict (z, force decision)
      See Also:
    • STRICT1

      public static final int STRICT1
      pattern set reduction: combined strict (z-1, force decision)
      See Also:
  • Constructor Details

    • JNICoCo

      public JNICoCo()
      Constructor.
      Since:
      2023.07.30 (Christian Borgelt)
  • Method Details

    • coconad

      public static Object[] coconad(double[][] trains, int target, double width, int supp, int zmin, int zmax, String report, int algo, int mode, int[] border)
      Java interface to CoCoNAD implementation in C.
      Parameters:
      trains - array of (spike) trains to analyze, each of which is an array of floating point numbers
      target - type of the patterns to find (ITEMSET, PERMUTATION PERMUT, SEQUENCE or SEQ as the target pattern type and FREQUENT, ALL, CLOSED or MAXIMAL as the target pattern subtype, with possibly added flag APPEND)
      width - width of the time window/maximum time span
      supp - minimum support of an item set
      zmin - minimum number of items per item set
      zmax - maximum number of items per item set
      report - values to report with an item set
      "a": item set support (number of coincidences)
      "|": pattern spectrum in column format
      "-": pattern spectrum with PatSpecElem
      "=": pattern spectrum with PatSpecElem
      algo - algorithm variant to use (BASIC, FILTER or CMREPO)
      mode - processing mode to use (NONE or flags NOPERFECT or NOSORT)
      border - array of support thresholds per item set size
      Returns:
      if report = "a": an array with two elements, the first of which is an array that contains the item sets as integer arrays, while the second is an integer array containing the support values (each corresponding to the item set at the same array index in the first array).
      if report = "|": an array with three elements; the first array contains the item set sizes as integers, the second array contains the support values as integers (that is, corresponding elements of the first and the second array form a pattern signature), and the third array contains the frequency (number of occurrences) of the size/support pair (at the same array index in the first two arrays) as a double precision floating point value.
      if report = '=' or '-': an array with objects of type PatSpecElem, each of which specifies a pattern signature together with its occurrence frequency.
      Since:
      2013.11.21 (Christian Borgelt)
    • coconad

      public static fim.PatternSet coconad(TrainSet trains, int target, double width, int supp, int zmin, int zmax, int algo, int mode, int[] border)
      Java interface to CoCoNAD implementation in C (wrapper with Java objects).
      Parameters:
      trains - (spike) trains to analyze
      target - type of the patterns to find (ITEMSET, PERMUTATION PERMUT, SEQUENCE or SEQ as the target pattern type and FREQUENT, ALL, CLOSED or MAXIMAL as the target pattern subtype, with possibly added flag APPEND)
      width - width of the time window/maximum time span
      supp - minimum support of an item set
      zmin - minimum number of items per item set
      zmax - maximum number of items per item set
      algo - algorithm variant to use (BASIC, FILTER or CMREPO)
      mode - processing mode to use (NONE or flags NOPERFECT or NOSORT)
      border - array of support thresholds per item set size
      Returns:
      a set of (frequent) patterns
      Since:
      2014.10.23 (Christian Borgelt)
    • genpsp

      public static Object[] genpsp(double[][] trains, int target, double width, int supp, int zmin, int zmax, String report, int algo, int mode, int cnt, double beg, double end, int surr, int rand, double sigma, double delta, int seed, int cpus, int[] ctrl)
      Pattern spectrum generation with surrogate data sets.
      Parameters:
      trains - array of (spike) trains to analyze, each of which is an array of floating point numbers
      target - type of the patterns to find (ITEMSET, PERMUTATION PERMUT, SEQUENCE or SEQ as the target pattern type and FREQUENT, ALL, CLOSED or MAXIMAL as the target pattern subtype, with possibly added flag APPEND)
      width - width of the time window/maximum time span
      supp - minimum support of an item set
      zmin - minimum number of items per item set
      zmax - maximum number of items per item set
      report - format in which to report the pattern spectrum
      "|": pattern spectrum in column format
      "-": pattern spectrum with PatSpecElem
      "=": pattern spectrum with PatSpecElem
      algo - algorithm variant to use (BASIC, FILTER or CMREPO)
      mode - processing mode to use (NONE or flags NOPERFECT or NOSORT)
      cnt - number of surrogate data sets to generate
      beg - beginning of allowed span of points
      end - end of allowed span of points
      surr - surrogate data generation method (IDENTITY, RANDOM, DITHER, SHIFT, KERNEST or PERMUTE)
      rand - random number density function (for point/spike displacements) (UNIFORM, RECT, TRIANG, GAUSS or NORMAL)
      sigma - standard deviation or half the base width of the rectangular/triangular density function
      delta - block size for blocked permutations
      seed - seed value for random number generator
      cpus - number of cpus/threads to use
      ctrl - control array (progress indicator, stop flag)
      Returns:
      if report = "|": an array with three elements; the first array contains the item set sizes as integers, the second array contains the support values as integers (that is, corresponding elements of the first and the second array form a pattern signature), and the third array contains the frequency (number of occurrences) of the size/support pair (at the same array index in the first two arrays) as a double precision floating point value.
      if report = '=' or '-': an array with objects of type PatSpecElem, each of which specifies a pattern signature together with its occurrence frequency.
      Since:
      2013.12.04 (Christian Borgelt)
    • genpsp

      public static fim.PatSpecElem[] genpsp(TrainSet trains, int target, double width, int supp, int zmin, int zmax, int algo, int mode, int cnt, double beg, double end, int surr, int rand, double sigma, double delta, int seed, int cpus, int[] ctrl)
      Pattern spectrum generation with surrogate data sets (wrapper with java objects).
      Parameters:
      trains - (spike) trains to analyze
      target - type of the patterns to find (ITEMSET, PERMUTATION PERMUT, SEQUENCE or SEQ as the target pattern type and FREQUENT, ALL, CLOSED or MAXIMAL as the target pattern subtype, with possibly added flag APPEND)
      width - width of the time window/maximum time span
      supp - minimum support of an item set
      zmin - minimum number of items per item set
      zmax - maximum number of items per item set
      algo - algorithm variant to use (BASIC, FILTER or CMREPO)
      mode - processing mode to use (NONE or flags NOPERFECT or NOSORT)
      cnt - number of surrogate data sets to generate
      beg - beginning of allowed span of points
      end - end of allowed span of points
      surr - surrogate data generation method (IDENTITY, RANDOM, DITHER, SHIFT, KERNEST or PERMUTE)
      rand - random number density function (for point/spike displacements) (UNIFORM, RECT, TRIANG, GAUSS or NORMAL)
      sigma - standard deviation or half the base width of the rectangular/triangular density function
      delta - block size for blocked permutations
      seed - seed value for random number generator
      cpus - number of cpus/threads to use
      ctrl - control array (progress indicator, stop flag)
      Returns:
      an array with objects of type PatSpecElem, each of which specifies a pattern signature together with its occurrence frequency
      Since:
      2014.10.23 (Christian Borgelt)
    • estpsp

      public static Object[] estpsp(double[][] trains, int target, double width, int supp, int zmin, int zmax, String report, int equiv, double alpha, int smpls, int seed)
      Estimate a pattern spectrum from data characteristics.
      Parameters:
      trains - array of (spike) trains to analyze, each of which is an array of floating point numbers
      target - type of the patterns to find (ITEMSET, PERMUTATION PERMUT, SEQUENCE or SEQ as the target pattern type and FREQUENT, ALL, CLOSED or MAXIMAL as the target pattern subtype)
      width - width of the time window/maximum time span
      supp - minimum support of an item set
      zmin - minimum number of items per item set
      zmax - maximum number of items per item set
      report - format in which to report the pattern spectrum
      "|": pattern spectrum in column format
      "-": pattern spectrum with PatSpecElem
      "=": pattern spectrum with PatSpecElem
      equiv - equivalent number of surrogate data sets
      alpha - probability dispersion factor
      smpls - number of samples per item set size
      seed - seed value for random number generator
      Returns:
      if report = "|": an array with three elements; the first array contains the item set sizes as integers, the second array contains the support values as integers (that is, corresponding elements of the first and the second array form a pattern signature), and the third array contains the frequency (number of occurrences) of the size/support pair (at the same array index in the first two arrays) as a double precision floating point value.
      if report = '=' or '-': an array with objects of type PatSpecElem, each of which specifies a pattern signature together with its occurrence frequency.
      Since:
      2014.03.06 (Christian Borgelt)
    • estpsp

      public static fim.PatSpecElem[] estpsp(TrainSet trains, int target, double width, int supp, int zmin, int zmax, int equiv, double alpha, int smpls, int seed)
      Estimate a pattern spectrum from data characteristics (wrapper with Java objects).
      Parameters:
      trains - (spike) trains to analyze
      target - type of the patterns to find (ITEMSET, PERMUTATION PERMUT, SEQUENCE or SEQ as the target pattern type and FREQUENT, ALL, CLOSED or MAXIMAL as the target pattern subtype)
      width - width of the time window/maximum time span
      supp - minimum support of an item set
      zmin - minimum number of items per item set
      zmax - maximum number of items per item set
      equiv - equivalent number of surrogate data sets
      alpha - probability dispersion factor
      smpls - number of samples per item set size
      seed - seed value for random number generator
      Returns:
      an array with objects of type PatSpecElem, each of which specifies a pattern signature together with its occurrence frequency
      Since:
      2014.10.23 (Christian Borgelt)
    • psp2bdr

      public static int[] psp2bdr(Object[] psp)
      Extract decision border from pattern spectrum.
      Parameters:
      psp - the pattern spectrum to process
      Returns:
      an array of minimum support values per pattern size; to be indexed by the pattern size
      Since:
      2015.08.13 (Christian Borgelt)
    • psp2bdr

      public static int[] psp2bdr(fim.PatSpecElem[] psp)
      Extract decision border from pattern spectrum.
      Parameters:
      psp - the pattern spectrum to process
      Returns:
      an array of minimum support values per pattern size; to be indexed by the pattern size
      Since:
      2015.08.13 (Christian Borgelt)
    • patred

      public static Object[] patred(Object[] pats, int method, int[] border, boolean addis)
      Reduce a pattern set.
      Parameters:
      pats - the pattern set to reduce as an array with two elements, the first of which is an array that contains the item sets as integer arrays, while the second is an integer array containing the support values (each corresponding to the item set the same array index in the first array)
      method - the pattern set reduction method (one of KEEP, COINS0, COINS1, ITEMS2, COVER0, COVER1, LENIENT0, LENIENT1, STRICT0, STRICT1)
      border - the decision border for rejecting patterns
      addis - whether to add pattern intersections
      Returns:
      the reduced pattern set as an array with two elements, the first of which is an array that contains the item sets as integer arrays, while the second is an integer array containing the support values (each corresponding to the item set the same array index in the first array)
      Since:
      2015.08.13 (Christian Borgelt)
    • patred

      public static fim.PatternSet patred(fim.PatternSet pats, int method, int[] border, boolean addis)
      Reduce a pattern set.
      Parameters:
      pats - the pattern set to reduce
      method - the pattern set reduction method (one of KEEP, COINS0, COINS1, ITEMS2, COVER0, COVER1, LENIENT0, LENIENT1, STRICT0, STRICT1)
      border - the decision border for rejecting patterns
      addis - whether to add pattern intersections
      Returns:
      the reduced pattern set
      Since:
      2015.08.13 (Christian Borgelt)
    • abort

      public static void abort(int state)
      Set the abort state (abort computations or clear abort state).
      Parameters:
      state - abort state to set (0: clear; != 0: signal abort)
      Since:
      2015.03.05 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main program for testing.
      Parameters:
      args - the command line arguments
      Since:
      2013.11.21 (Christian Borgelt)