com.rapidminer.operator.learner.functions.kernel.jmysvm.svm
Class SVM

java.lang.Object
  extended by com.rapidminer.operator.learner.functions.kernel.jmysvm.svm.SVM
All Implemented Interfaces:
SVMInterface
Direct Known Subclasses:
SVMpattern, SVMregression

public abstract class SVM
extends java.lang.Object
implements SVMInterface

Abstract base class for all SVMs

Author:
Stefan Rueping, Ingo Mierswa

Field Summary
protected  int[] at_bound
           
protected  double C
           
protected  double[] cNeg
           
protected  double convergence_epsilon
           
protected  double[] cPos
           
protected  double descend
           
protected  double epsilon_neg
           
protected  double epsilon_pos
           
protected  int examples_total
           
protected  double feasible_epsilon
           
protected  double is_zero
           
protected  double lambda_eq
           
protected  double lambda_factor
           
protected  double lambda_WS
           
protected  int parameters_working_set_size
           
protected  double[] primal
           
protected  QuadraticProblem qp
           
protected  boolean quadraticLossNeg
           
protected  boolean quadraticLossPos
           
protected  int shrink_const
           
protected  double[] sum
           
protected  double sum_alpha
           
protected  int target_count
           
protected  SVMExamples the_examples
           
protected  Kernel the_kernel
           
protected  int to_shrink
           
protected  boolean[] which_alpha
           
protected  int[] working_set
           
protected  int working_set_size
           
 
Constructor Summary
SVM()
           
SVM(Operator paramOperator, Kernel new_kernel, SVMExamples new_examples, ExampleSet rapidMinerExamples, RandomGenerator randomGenerator)
          class constructor.
 
Method Summary
protected  void calculate_working_set()
          Calculates the working set
protected  void check()
          check internal variables, for debugging only
protected  boolean convergence()
          Checks if the optimization converged
protected  void exit_optimizer()
          exit the optimizer
protected  boolean feasible(int i)
           
 double getB()
          Returns the value of b.
 double getC()
          Gets the complexity constant of the svm.
 double[] getWeights()
          Return the weights of the features.
 double[] getXiAlphaEstimation(Kernel kernel)
          Returns a double array of estimated performance values.
protected  void init_optimizer()
          init the optimizer
protected  void init_working_set()
          Initialises the working set
 void init(Kernel new_kernel, SVMExamples new_examples)
          Init the SVM
protected abstract  boolean is_alpha_neg(int i)
           
protected  double lambda(int i)
          lagrangion multiplier of variable i
protected  void logln(int level, java.lang.String message)
          log the output plus newline
protected  void logWarning(java.lang.String message)
           
protected abstract  double nabla(int i)
           
protected abstract  void optimize()
          Calls the optimizer
 double predict(int i)
           
 double predict(SVMExample sVMExample)
          predict a single example
 void predict(SVMExamples to_predict)
          predict values on the testset with model
protected  void print_statistics()
          print statistics about result
protected  void project_to_constraint()
          Project variables to constraints
protected  void put_optimizer_values()
          Stores the optimizer results
protected  void reset_shrinked()
          reset the shrinked variables
protected  void shrink()
          shrink the variables
 void train()
          Train the SVM
protected  void update_working_set()
          Updates the working set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

the_kernel

protected Kernel the_kernel

the_examples

protected SVMExamples the_examples

examples_total

protected int examples_total

target_count

protected int target_count

convergence_epsilon

protected double convergence_epsilon

lambda_factor

protected double lambda_factor

at_bound

protected int[] at_bound

sum

protected double[] sum

which_alpha

protected boolean[] which_alpha

working_set

protected int[] working_set

primal

protected double[] primal

sum_alpha

protected double sum_alpha

lambda_eq

protected double lambda_eq

to_shrink

protected int to_shrink

feasible_epsilon

protected double feasible_epsilon

lambda_WS

protected double lambda_WS

quadraticLossPos

protected boolean quadraticLossPos

quadraticLossNeg

protected boolean quadraticLossNeg

epsilon_pos

protected double epsilon_pos

epsilon_neg

protected double epsilon_neg

working_set_size

protected int working_set_size

parameters_working_set_size

protected int parameters_working_set_size

is_zero

protected double is_zero

shrink_const

protected int shrink_const

C

protected double C

cPos

protected double[] cPos

cNeg

protected double[] cNeg

descend

protected double descend

qp

protected QuadraticProblem qp
Constructor Detail

SVM

public SVM()

SVM

public SVM(Operator paramOperator,
           Kernel new_kernel,
           SVMExamples new_examples,
           ExampleSet rapidMinerExamples,
           RandomGenerator randomGenerator)
    throws UndefinedParameterError
class constructor. Throws an operator exception if a non-optional parameter was not set and has no default value.

Throws:
UndefinedParameterError
Method Detail

init

public void init(Kernel new_kernel,
                 SVMExamples new_examples)
Init the SVM

Specified by:
init in interface SVMInterface
Parameters:
new_kernel - new kernel function.
new_examples - the data container

train

public void train()
Train the SVM

Specified by:
train in interface SVMInterface

print_statistics

protected void print_statistics()
print statistics about result


getWeights

public double[] getWeights()
Return the weights of the features.

Specified by:
getWeights in interface SVMInterface

getB

public double getB()
Returns the value of b.

Specified by:
getB in interface SVMInterface

getC

public double getC()
Gets the complexity constant of the svm.


init_optimizer

protected void init_optimizer()
init the optimizer


exit_optimizer

protected void exit_optimizer()
exit the optimizer


shrink

protected void shrink()
shrink the variables


reset_shrinked

protected void reset_shrinked()
reset the shrinked variables


project_to_constraint

protected void project_to_constraint()
Project variables to constraints


calculate_working_set

protected void calculate_working_set()
Calculates the working set

Throws:
java.lang.Exception - on any error

update_working_set

protected void update_working_set()
Updates the working set


init_working_set

protected void init_working_set()
Initialises the working set

Throws:
java.lang.Exception - on any error

optimize

protected abstract void optimize()
Calls the optimizer


put_optimizer_values

protected void put_optimizer_values()
Stores the optimizer results


convergence

protected boolean convergence()
Checks if the optimization converged

Returns:
boolean true optimzation if converged

nabla

protected abstract double nabla(int i)

lambda

protected double lambda(int i)
lagrangion multiplier of variable i

Parameters:
i - variable index
Returns:
lambda

feasible

protected boolean feasible(int i)

is_alpha_neg

protected abstract boolean is_alpha_neg(int i)

logln

protected void logln(int level,
                     java.lang.String message)
log the output plus newline

Parameters:
level - warning level
message - Message test

logWarning

protected void logWarning(java.lang.String message)

predict

public void predict(SVMExamples to_predict)
predict values on the testset with model

Specified by:
predict in interface SVMInterface

predict

public double predict(int i)

predict

public double predict(SVMExample sVMExample)
predict a single example

Specified by:
predict in interface SVMInterface

check

protected void check()
check internal variables, for debugging only


getXiAlphaEstimation

public double[] getXiAlphaEstimation(Kernel kernel)
Returns a double array of estimated performance values. These are accuracy, precision and recall. Works only for classification SVMs.



Copyright © 2001-2009 by Rapid-I