at.tuwien.ifs.somtoolbox.data.distance
Class DistanceMatrixWriter

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.data.distance.DistanceMatrixWriter
All Implemented Interfaces:
SOMToolboxApp

public class DistanceMatrixWriter
extends Object
implements SOMToolboxApp

Writes the input matrix for a given data set to an ASCII or binary format. A distance matrix is of size n*n, where n is the number of elements. The matrix is symmetric, i.e. the upper-right and lower-left halves contain the same values. The diagonal contains the distances of one element to itself, and is thus always 0.
Supported formats are:

Version:
$Id: DistanceMatrixWriter.java 3869 2010-10-21 15:56:09Z mayer $
Author:
Rudolf Mayer

Nested Class Summary
 
Nested classes/interfaces inherited from interface at.tuwien.ifs.somtoolbox.apps.SOMToolboxApp
SOMToolboxApp.Type
 
Field Summary
static SOMToolboxApp.Type APPLICATION_TYPE
           
private static String BINARY
          Binary format (for RandomAccessFile
static String DESCRIPTION
           
static String LONG_DESCRIPTION
           
private static com.martiansoftware.jsap.FlaggedOption OPT_CLASS_INFORMATION_FILE
           
static com.martiansoftware.jsap.Parameter[] OPTIONS
           
private static String ORANGE
          Format for the Orange data mining tool (http://www.ailab.si/orange/)
static String[] OUTPUT_FORMATS
           
private static String PLAIN
           
private static String SOM_LIB
          SOMLib format (half-matrix)
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.apps.SOMToolboxApp
DEV_BY_STRING, HOMEPAGE, REQUIRED_MEMBERS, TYPE_GROUPED_COMPARATOR
 
Constructor Summary
DistanceMatrixWriter()
           
 
Method Summary
static void main(String[] args)
           
private static PrintWriter printSOMLibHeader(int numVectors, String fileName, DistanceMetric metric, boolean gzip)
           
static void writeOrangeFileInputVectorDistanceMatrix(InputData data, String fileName, DistanceMetric metric)
          Write input distance matrix to an ASCII file for the Orange data mining toolkit ((http://www.ailab.si/orange/), computing distances on the fly.
static void writePlainFileInputVectorDistanceMatrix(InputData data, String fileName, DistanceMetric metric)
          Write input distance matrix to an ASCII file in plain format, computing distances on the fly.
static void writeRandomAccessFileInputVectorDistanceMatrix(double[][] distances, String fileName, DistanceMetric metric)
          Write pre-calculated input distance matrix to a binary file.
static void writeRandomAccessFileInputVectorDistanceMatrix(InputData data, String fileName, DistanceMetric metric)
          Write input distance matrix to a binary file, computing distances on the fly.
static void writeSOMLibFileInputVectorDistanceMatrix(double[][] distances, String fileName, DistanceMetric metric, boolean gzip)
          Write pre-calculated input distance matrix to an ASCII file in SOMLib format.
static void writeSOMLibFileInputVectorDistanceMatrix(InputData data, String fileName, DistanceMetric metric)
          Write input distance matrix to ASCII file, computing distances on the fly.
static void writeSOMLibFileInputVectorDistanceMatrix(InputData data, String fileName, DistanceMetric metric, boolean gzip)
          Write input distance matrix to ASCII file, computing distances on the fly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPT_CLASS_INFORMATION_FILE

private static final com.martiansoftware.jsap.FlaggedOption OPT_CLASS_INFORMATION_FILE

ORANGE

private static final String ORANGE
Format for the Orange data mining tool (http://www.ailab.si/orange/)

See Also:
Constant Field Values

BINARY

private static final String BINARY
Binary format (for RandomAccessFile

See Also:
Constant Field Values

SOM_LIB

private static final String SOM_LIB
SOMLib format (half-matrix)

See Also:
Constant Field Values

PLAIN

private static final String PLAIN
See Also:
Constant Field Values

OUTPUT_FORMATS

public static String[] OUTPUT_FORMATS

APPLICATION_TYPE

public static final SOMToolboxApp.Type APPLICATION_TYPE

DESCRIPTION

public static final String DESCRIPTION
See Also:
Constant Field Values

LONG_DESCRIPTION

public static final String LONG_DESCRIPTION
See Also:
Constant Field Values

OPTIONS

public static final com.martiansoftware.jsap.Parameter[] OPTIONS
Constructor Detail

DistanceMatrixWriter

public DistanceMatrixWriter()
Method Detail

main

public static void main(String[] args)
                 throws SOMToolboxException,
                        IOException
Throws:
SOMToolboxException
IOException

writeSOMLibFileInputVectorDistanceMatrix

public static void writeSOMLibFileInputVectorDistanceMatrix(InputData data,
                                                            String fileName,
                                                            DistanceMetric metric)
                                                     throws IOException,
                                                            MetricException
Write input distance matrix to ASCII file, computing distances on the fly.

Throws:
IOException
MetricException

writeSOMLibFileInputVectorDistanceMatrix

public static void writeSOMLibFileInputVectorDistanceMatrix(InputData data,
                                                            String fileName,
                                                            DistanceMetric metric,
                                                            boolean gzip)
                                                     throws IOException,
                                                            MetricException
Write input distance matrix to ASCII file, computing distances on the fly.

Throws:
IOException
MetricException

writePlainFileInputVectorDistanceMatrix

public static void writePlainFileInputVectorDistanceMatrix(InputData data,
                                                           String fileName,
                                                           DistanceMetric metric)
                                                    throws IOException,
                                                           MetricException
Write input distance matrix to an ASCII file in plain format, computing distances on the fly.

Throws:
IOException
MetricException

writeOrangeFileInputVectorDistanceMatrix

public static void writeOrangeFileInputVectorDistanceMatrix(InputData data,
                                                            String fileName,
                                                            DistanceMetric metric)
                                                     throws IOException,
                                                            MetricException
Write input distance matrix to an ASCII file for the Orange data mining toolkit ((http://www.ailab.si/orange/), computing distances on the fly.

Throws:
IOException
MetricException

writeSOMLibFileInputVectorDistanceMatrix

public static void writeSOMLibFileInputVectorDistanceMatrix(double[][] distances,
                                                            String fileName,
                                                            DistanceMetric metric,
                                                            boolean gzip)
                                                     throws IOException,
                                                            MetricException
Write pre-calculated input distance matrix to an ASCII file in SOMLib format.

Throws:
IOException
MetricException

printSOMLibHeader

private static PrintWriter printSOMLibHeader(int numVectors,
                                             String fileName,
                                             DistanceMetric metric,
                                             boolean gzip)
                                      throws IOException
Throws:
IOException

writeRandomAccessFileInputVectorDistanceMatrix

public static void writeRandomAccessFileInputVectorDistanceMatrix(InputData data,
                                                                  String fileName,
                                                                  DistanceMetric metric)
                                                           throws IOException,
                                                                  MetricException
Write input distance matrix to a binary file, computing distances on the fly.

Throws:
IOException
MetricException

writeRandomAccessFileInputVectorDistanceMatrix

public static void writeRandomAccessFileInputVectorDistanceMatrix(double[][] distances,
                                                                  String fileName,
                                                                  DistanceMetric metric)
                                                           throws IOException,
                                                                  MetricException
Write pre-calculated input distance matrix to a binary file.

Throws:
IOException
MetricException