ec.cgp.functions
Class FunctionsBreastCancerY

java.lang.Object
  extended by ec.cgp.functions.FunctionsBreastCancerY
All Implemented Interfaces:
Functions
Direct Known Subclasses:
FunctionsBreastCancerW, FunctionsIris

public class FunctionsBreastCancerY
extends java.lang.Object
implements Functions

Function set for the Breast Cancer (Wisconsin) classification problem.

Author:
David Oranchak, doranchak@gmail.com, http://oranchak.com

Field Summary
(package private) static int F_ADD
          add
(package private) static int F_AND
          logical and
(package private) static int F_DIV
          safe divide; return 1 if divisor is 0.
(package private) static int F_EQ
          equal to
(package private) static int F_GT
          greater than
(package private) static int F_GTE
          greater than or equal to
(package private) static int F_IF
          if...
(package private) static int F_IFLEZ
          if less than zero then...
(package private) static int F_LT
          less than
(package private) static int F_LTE
          less than or equal to
(package private) static int F_MUL
          multiply
(package private) static int F_NAND
          logical nand
(package private) static int F_NEG
          negate
(package private) static int F_NOR
          logical nor
(package private) static int F_NOT
          logical not
(package private) static int F_OR
          logical or
(package private) static int F_SUB
          subtract
 
Constructor Summary
FunctionsBreastCancerY()
           
 
Method Summary
 int arityOf(int fn)
          Return the arity of the given function
static float b2f(boolean inp)
          Convert the given boolean to float.
 java.lang.Object callFunction(java.lang.Object[] inputs, int function, int numFunctions)
          Interpret the given function and apply it to the given inputs.
static boolean f2b(float inp)
          Interpret the given float as a boolean value.
 java.lang.String functionName(int fn)
          Return a function name, suitable for display in expressions, for the given function.
 java.lang.String inputName(int inp, java.lang.Object val)
          Return the name, suitable for display, for the given input.
static void main(java.lang.String[] args)
           
static void testFunctions()
          Simple test of the function set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

F_ADD

static int F_ADD
add


F_SUB

static int F_SUB
subtract


F_MUL

static int F_MUL
multiply


F_DIV

static int F_DIV
safe divide; return 1 if divisor is 0.


F_LT

static int F_LT
less than


F_LTE

static int F_LTE
less than or equal to


F_GT

static int F_GT
greater than


F_GTE

static int F_GTE
greater than or equal to


F_EQ

static int F_EQ
equal to


F_AND

static int F_AND
logical and


F_OR

static int F_OR
logical or


F_NOT

static int F_NOT
logical not


F_NOR

static int F_NOR
logical nor


F_NAND

static int F_NAND
logical nand


F_NEG

static int F_NEG
negate


F_IF

static int F_IF
if... then... else


F_IFLEZ

static int F_IFLEZ
if less than zero then... else...

Constructor Detail

FunctionsBreastCancerY

public FunctionsBreastCancerY()
Method Detail

callFunction

public java.lang.Object callFunction(java.lang.Object[] inputs,
                                     int function,
                                     int numFunctions)
Interpret the given function and apply it to the given inputs.

Specified by:
callFunction in interface Functions
Parameters:
inputs - The arguments passed to the function. It is possible that some or all of the arguments will be unused by some functions.
function - The function number. Every function number must map to a function.
numFunctions - The total number of functions available.
Returns:
the result of the function call

f2b

public static boolean f2b(float inp)
Interpret the given float as a boolean value. Any value > 0 is interpreted as "true".


b2f

public static float b2f(boolean inp)
Convert the given boolean to float. "True" is 1.0; "false" is -1.0.


functionName

public java.lang.String functionName(int fn)
Return a function name, suitable for display in expressions, for the given function.

Specified by:
functionName in interface Functions
Parameters:
fn - The function number
Returns:
The descriptive function name that corresponds to this function number.

arityOf

public int arityOf(int fn)
Return the arity of the given function

Specified by:
arityOf in interface Functions
Parameters:
fn - the function number
Returns:
The number of inputs this function expects.

inputName

public java.lang.String inputName(int inp,
                                  java.lang.Object val)
Return the name, suitable for display, for the given input.

Specified by:
inputName in interface Functions
Parameters:
inp - The input number
val - Optional input value (needed if you want to display a constant value for this input)
Returns:
The descriptive input name that corresponds to this input.

testFunctions

public static void testFunctions()
Simple test of the function set.


main

public static void main(java.lang.String[] args)