Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki
Class KDDTask<O extends DatabaseObject>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          extended by de.lmu.ifi.dbs.elki.KDDTask<O>
Type Parameters:
O - the type of DatabaseObjects handled by this Algorithm
All Implemented Interfaces:
Loggable, Parameterizable

public class KDDTask<O extends DatabaseObject>
extends AbstractParameterizable

Provides a KDDTask that can be used to perform any algorithm implementing Algorithm using any DatabaseConnection implementing DatabaseConnection.

Author:
Arthur Zimek

Field Summary
private  Algorithm<O> algorithm
          Holds the algorithm to run.
private  ClassParameter<Algorithm> ALGORITHM_PARAM
          Parameter to specify the algorithm to be applied, must extend Algorithm.
private static String CALL
          The String for calling this class' main routine on command line interface.
private  ClassParameter<DatabaseConnection> DATABASE_CONNECTION_PARAM
          Parameter to specify the database connection to be used, must extend DatabaseConnection.
private  DatabaseConnection<O> databaseConnection
          Holds the database connection to have the algorithm run with.
private  ClassParameter<Parameterizable> DESCRIPTION_PARAM
          Optional Parameter to specify a class to obtain a description for, must extend Parameterizable.
private  Flag HELP_FLAG
          Flag to obtain help-message.
private  Flag HELP_LONG_FLAG
          Flag to obtain help-message.
private  OptionHandler helpOptionHandler
           
static String INFORMATION
          Information for citation and version.
private  boolean initialized
          Whether KDDTask has been properly initialized for calling the run()-method.
private static String NEWLINE
          The newline string according to system.
private  Normalization<O> normalization
          A normalization - per default no normalization is used.
private  ClassParameter<Normalization> NORMALIZATION_PARAM
          Optional Parameter to specify a normalization in order to use a database with normalized values.
private  Flag NORMALIZATION_UNDO_FLAG
          Flag to revert result to original values - invalid option if no normalization has been performed..
private  boolean normalizationUndo
          Whether to undo normalization for result.
private  File out
          Holds the file to print results to.
private  FileParameter OUTPUT_PARAM
          Optional Parameter to specify the file to write the obtained results in.
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug
 
Constructor Summary
KDDTask()
          Provides a KDDTask.
 
Method Summary
 String description()
          Returns a description for printing on command line interface.
 List<AttributeSettings> getAttributeSettings()
          Returns the parameter setting of the attributes.
static void main(String[] args)
          Runs a KDD task accordingly to the specified parameters.
 Result<O> run()
          Method to run the specified algorithm using the specified database connection.
 String[] setParameters(String[] args)
          Sets the options accordingly to the specified list of parameters.
 String usage(String message)
          Returns a usage message with the specified message as leading line, and information as provided by optionHandler.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, checkGlobalParameterConstraints, deleteOption, description, description, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, setParameters
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFORMATION

public static final String INFORMATION
Information for citation and version.

See Also:
Constant Field Values

CALL

private static final String CALL
The String for calling this class' main routine on command line interface.


NEWLINE

private static final String NEWLINE
The newline string according to system.


HELP_FLAG

private final Flag HELP_FLAG
Flag to obtain help-message.

Key: -h


HELP_LONG_FLAG

private final Flag HELP_LONG_FLAG
Flag to obtain help-message.

Key: -help


ALGORITHM_PARAM

private final ClassParameter<Algorithm> ALGORITHM_PARAM
Parameter to specify the algorithm to be applied, must extend Algorithm.

Key: -algorithm


DESCRIPTION_PARAM

private final ClassParameter<Parameterizable> DESCRIPTION_PARAM
Optional Parameter to specify a class to obtain a description for, must extend Parameterizable.

Key: -description


DATABASE_CONNECTION_PARAM

private final ClassParameter<DatabaseConnection> DATABASE_CONNECTION_PARAM
Parameter to specify the database connection to be used, must extend DatabaseConnection.

Key: -dbc

Default value: FileBasedDatabaseConnection


OUTPUT_PARAM

private final FileParameter OUTPUT_PARAM
Optional Parameter to specify the file to write the obtained results in. If this parameter is omitted, per default the output will sequentially be given to STDOUT.

Key: -out


NORMALIZATION_PARAM

private final ClassParameter<Normalization> NORMALIZATION_PARAM
Optional Parameter to specify a normalization in order to use a database with normalized values.

Key: -norm


NORMALIZATION_UNDO_FLAG

private final Flag NORMALIZATION_UNDO_FLAG
Flag to revert result to original values - invalid option if no normalization has been performed..

Key: -normUndo


algorithm

private Algorithm<O extends DatabaseObject> algorithm
Holds the algorithm to run.


databaseConnection

private DatabaseConnection<O extends DatabaseObject> databaseConnection
Holds the database connection to have the algorithm run with.


out

private File out
Holds the file to print results to.


initialized

private boolean initialized
Whether KDDTask has been properly initialized for calling the run()-method.


normalization

private Normalization<O extends DatabaseObject> normalization
A normalization - per default no normalization is used.


normalizationUndo

private boolean normalizationUndo
Whether to undo normalization for result.


helpOptionHandler

private OptionHandler helpOptionHandler
Constructor Detail

KDDTask

public KDDTask()
Provides a KDDTask.

Method Detail

description

public String description()
Returns a description for printing on command line interface.

Specified by:
description in interface Parameterizable
Overrides:
description in class AbstractParameterizable
Returns:
String a description of the class and the required parameters
See Also:
Parameterizable.description()

usage

public String usage(String message)
Returns a usage message with the specified message as leading line, and information as provided by optionHandler. If an algorithm is specified, the description of the algorithm is returned.

Parameters:
message - a message to be include in the usage message
Returns:
a usage message with the specified message as leading line, and information as provided by optionHandler

setParameters

public String[] setParameters(String[] args)
                       throws ParameterException
Sets the options accordingly to the specified list of parameters.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractParameterizable
Parameters:
args - parameters to set the attributes accordingly to
Returns:
String[] an array containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting
See Also:
Parameterizable.setParameters(String[])

getAttributeSettings

public List<AttributeSettings> getAttributeSettings()
Returns the parameter setting of the attributes.

Specified by:
getAttributeSettings in interface Parameterizable
Overrides:
getAttributeSettings in class AbstractParameterizable
Returns:
the parameter setting of the attributes
See Also:
Parameterizable.getAttributeSettings()

run

public Result<O> run()
                                     throws IllegalStateException
Method to run the specified algorithm using the specified database connection.

Returns:
the result of the specified algorithm
Throws:
IllegalStateException - if initialization has not been done properly (i.e. setParameters(String[]) has not been called before calling this method)

main

public static void main(String[] args)
Runs a KDD task accordingly to the specified parameters.

Parameters:
args - parameter list according to description

Release 0.1 (2008-07-10_1838)