edu.udo.cs.miningmart.compiler.wrapper
Class DB_SVM

java.lang.Object
  extended byedu.udo.cs.miningmart.compiler.wrapper.SVM_Wrapper
      extended byedu.udo.cs.miningmart.compiler.wrapper.DB_SVM
Direct Known Subclasses:
DB_SVM_CL, DB_SVM_RG

public abstract class DB_SVM
extends SVM_Wrapper

The wrapper class for mySVM/db, the version of mySVM that runs inside the database. The wrapper assumes that mySVM/db is already installed in the database.

Version:
$Id: DB_SVM.java,v 1.4 2006/04/11 14:10:17 euler Exp $
Author:
Timm Euler

Field Summary
 
Fields inherited from class edu.udo.cs.miningmart.compiler.wrapper.SVM_Wrapper
b, DEFAULTSAMPLESIZE, forClassification, inputTableName, lossNeg, lossPos, myStepId, noSV, SAMPLE_TABLE_PREFIX, sampleSize, schema, targetColSQLDefinition, targetPositive, TEMP_TABLE_PREFIX, theColumnInfos, useOracle, usePostgres, xiAlphaEstimation
 
Constructor Summary
DB_SVM(CompilerDatabaseService databaseObj, Print printObj, java.lang.String nameForDatabaseUse, java.lang.String nameOfDatabaseSchema, long stepId, java.lang.String colNameKeyColumn)
          Use this constructor if no sampling is wanted.
DB_SVM(CompilerDatabaseService databaseObj, Print printObj, java.lang.String nameForDatabaseUse, java.lang.String nameOfDatabaseSchema, long stepId, java.lang.String colNameKeyColumn, long sampleSize)
          Use this constructor if sampling on the input data is wanted.
 
Method Summary
 void callSVM(Columnset inputColumnset, Column targetColumn, long conceptId, java.lang.String c, java.lang.String kernelType, java.lang.String epsilon, java.util.Vector predictingColumns)
          This is the wrapper.
protected  void checkColSetType(java.lang.String type)
           
protected  void checkKernel(java.lang.String kern)
           
protected  void extractNumberSV()
          Must be implemented by subclasses.
protected  java.util.Vector getColNamesInput()
           
protected  java.lang.String getModelTablePlusCondition()
           
 
Methods inherited from class edu.udo.cs.miningmart.compiler.wrapper.SVM_Wrapper
checkDouble, checkForConversion, createBody, createDecisionFunctionAsSQL_Function, createDecisionFunctionTemplate, createDeclaration, extractXiAlpha, getCompleteSelectString, getDatabaseObj, getDBMS_Datatype, getDecisionFunctionName, getDecisionFunctionNameWithArgumentTypes, getDecisionFunctionNameWithSchema, getInputViewName, getKernelParams, getLogTableName, getModelTableName, getNumberOfSupportVectors, getOutputViewName, getParTableName, getPositiveTargetValue, getPrint, getSampleRatio, getXiAlphaEstimation, insertFunctionIntoDB, replace, setPositiveTargetValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB_SVM

public DB_SVM(CompilerDatabaseService databaseObj,
              Print printObj,
              java.lang.String nameForDatabaseUse,
              java.lang.String nameOfDatabaseSchema,
              long stepId,
              java.lang.String colNameKeyColumn)
       throws M4CompilerError
Use this constructor if no sampling is wanted. The connections to the databases are needed because the SVMs need to read metadata as well as data and create an intermediate table in the database.

Parameters:
databaseObj - the DB object to be used for database connections
printObj - the Print object to be used for log messages
nameForDatabaseUse - Prefix for all functions, view and tables that this wrapper creates in the database
nameOfDatabaseSchema - Name of the database schema that holds the business views and tables
stepId - Id of the step
colNameKeyColumn - Name of the column that is the primary key for the input data table
Throws:
M4CompilerError - A simple exception object with an error message.

DB_SVM

public DB_SVM(CompilerDatabaseService databaseObj,
              Print printObj,
              java.lang.String nameForDatabaseUse,
              java.lang.String nameOfDatabaseSchema,
              long stepId,
              java.lang.String colNameKeyColumn,
              long sampleSize)
       throws M4CompilerError
Use this constructor if sampling on the input data is wanted. The connections to the databases are needed because the SVMs need to read metadata as well as data and create an intermediate table in the database.

Parameters:
databaseObj - the DB object to be used for database connections
printObj - the Print object to be used for log messages
nameForDatabaseUse - Prefix for all functions, view and tables that this wrapper creates in the database
nameOfDatabaseSchema - Name of the database schema that holds the business views and tables
stepId - Id of the step
colNameKeyColumn - Name of the column that is the primary key for the input data table
sampleSize - maximum number of rows to be used to train the SVM
Throws:
M4CompilerError - A simple exception object with an error message.
Method Detail

callSVM

public void callSVM(Columnset inputColumnset,
                    Column targetColumn,
                    long conceptId,
                    java.lang.String c,
                    java.lang.String kernelType,
                    java.lang.String epsilon,
                    java.util.Vector predictingColumns)
             throws M4CompilerError
This is the wrapper. This method is used to call the mySVM/db algorithm in the database for training with the specified parameters.

Specified by:
callSVM in class SVM_Wrapper
Parameters:
inputColumnset - ColumnSet in the database that belongs to the input Concept of the operator that uses this wrapper. The Columns that the SVM learns from belong to this ColumnSet.
targetColumn - the Column in the database that belongs to the target attribute of the operator that uses this wrapper.
conceptId - Unique M4 Id of the input Concept of the operator that uses this wrapper.
c - The parameter C for the support vector machine.
kernelType - One of "dot" or "radial".
epsilon - The parameter epsilon for the support vector machine.
predictingColumns - A Vector with the Columns in the database that the support vector machine will use as learning attributes.
Throws:
M4CompilerError - A simple exception object with an error message.

checkColSetType

protected void checkColSetType(java.lang.String type)
                        throws M4CompilerError
Specified by:
checkColSetType in class SVM_Wrapper
Throws:
M4CompilerError

checkKernel

protected void checkKernel(java.lang.String kern)
                    throws M4CompilerError
Specified by:
checkKernel in class SVM_Wrapper
Throws:
M4CompilerError

getColNamesInput

protected java.util.Vector getColNamesInput()
Specified by:
getColNamesInput in class SVM_Wrapper

getModelTablePlusCondition

protected java.lang.String getModelTablePlusCondition()
                                               throws M4CompilerError
Specified by:
getModelTablePlusCondition in class SVM_Wrapper
Throws:
M4CompilerError

extractNumberSV

protected void extractNumberSV()
                        throws M4CompilerError
Description copied from class: SVM_Wrapper
Must be implemented by subclasses. Extracts the number of support vectors from the output of the SVM algorithm so that the public method getNumberOfSupportVectors() can return the right value.

Specified by:
extractNumberSV in class SVM_Wrapper
Throws:
M4CompilerError


Copyright © 2001-2005