weka.classifiers.m5
Class Function

java.lang.Object
  |
  +--weka.classifiers.m5.Function
All Implemented Interfaces:
Serializable

public final class Function
extends Object
implements Serializable

Class for handling a linear function.

Version:
$Revision: 1.4 $
Author:
Yong Wang (yongwang@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
Function()
          Constructs a function of constant value
Function(Instances inst)
          Constucts a function with all attributes except the class in the inst
Function(int attr)
          Constructs a function with one attribute
 
Method Summary
static Function combine(Function f1, Function f2)
          Constructs a new function of which the variable list is a combination of those of two functions
 Function copy()
          Makes a copy of a function
 Errors errors(Instances inst)
          Evaluates a function
 int insignificant(double sdy, Instances inst)
          Detects the most insignificant variable in the funcion
 double predict(Instance instance)
          Returns the predicted value of instance i by a function
 Function remove(int j)
          Removes a term from the function
 String toString(Instances inst, int startPoint)
          Converts a function to a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Function

public Function()
Constructs a function of constant value


Function

public Function(Instances inst)
Constucts a function with all attributes except the class in the inst

Parameters:
inst - instances

Function

public Function(int attr)
Constructs a function with one attribute

Parameters:
attr - an attribute
Method Detail

copy

public final Function copy()
Makes a copy of a function

Returns:
the copy of the function

toString

public final String toString(Instances inst,
                             int startPoint)
                      throws Exception
Converts a function to a string

Parameters:
inst - instances
startPoint - the starting point on the screen; used to feed line before reaching beyond 80 characters
Returns:
the converted string
Throws:
Exception - if something goes wrong

combine

public static final Function combine(Function f1,
                                     Function f2)
Constructs a new function of which the variable list is a combination of those of two functions

Parameters:
f1 - function 1
f2 - function 2
Returns:
the newly constructed function

errors

public final Errors errors(Instances inst)
                    throws Exception
Evaluates a function

Parameters:
inst - instances
Returns:
the evaluation results
Throws:
Exception - if something goes wrong

predict

public final double predict(Instance instance)
Returns the predicted value of instance i by a function

Returns:
the predicted value

insignificant

public final int insignificant(double sdy,
                               Instances inst)
Detects the most insignificant variable in the funcion

Parameters:
sdy - the standard deviation of the class variable
inst - instances
Returns:
the index of the most insignificant variable in the function

remove

public final Function remove(int j)
Removes a term from the function

Parameters:
j - the j-th index in the variable list in the function
Returns:
the new function with the term removed