edu.ksu.cis.kdd.tiler
Class CMAC

java.lang.Object
  extended byedu.ksu.cis.kdd.tiler.CMAC

public class CMAC
extends java.lang.Object

Adaptation of Rich Sutton's CMAC tiler v2.0. See:
http://www-anw.cs.umass.edu/~rich/tiles2.html

Basic version.

Author:
Roby Joehanes

Field Summary
static CMAC v
           
 
Constructor Summary
CMAC()
          Default constructor with 2048 entries of random numbers
CMAC(int randomsize)
           
 
Method Summary
 int[] getTiles(int numTile, int maxVarSize, double[] nums)
           
 int[] getTiles(int numTile, int maxVarSize, double[] nums, int h1)
           
 int[] getTiles(int numTile, int maxVarSize, double[] nums, int[] hashModifier)
          Do the CMAC tiling.
protected  int hash(int[] num, int maxValue, int incr)
          UNH hashing procedure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

public static CMAC v
Constructor Detail

CMAC

public CMAC()
Default constructor with 2048 entries of random numbers

See Also:
Object.Object()

CMAC

public CMAC(int randomsize)
Method Detail

getTiles

public int[] getTiles(int numTile,
                      int maxVarSize,
                      double[] nums)
See Also:
getTiles(int, int, double[], int[])

getTiles

public int[] getTiles(int numTile,
                      int maxVarSize,
                      double[] nums,
                      int h1)
See Also:
getTiles(int, int, double[], int[])

getTiles

public int[] getTiles(int numTile,
                      int maxVarSize,
                      double[] nums,
                      int[] hashModifier)
Do the CMAC tiling.

Parameters:
numTile - The number of tile elements to output (corresponds to the num_tilings)
maxVarSize - The maximum number elements if there were no tilings (corresponds to the memory_size), try to make it a power of two if possible.
nums - The numbers to tile (corresponds to floats)
hashModifier - An array of integers to modify the hashing procedures. If null, then we do the default hashing. (corresponds to ints).
Returns:
int[] The tiles (corresponds to the parameter tiles)

hash

protected int hash(int[] num,
                   int maxValue,
                   int incr)
UNH hashing procedure. It utilizes the variable rand[], array of random numbers. I implemented the random call using MersenneTwisterFast.

Parameters:
num - The number arrays to determine the hashing
maxValue - The maximum value of the result
incr - The increment parameter
Returns:
int The hash value output