at.tuwien.ifs.somtoolbox.apps.helper
Class VectorFileToRandomAccessFileConverter
java.lang.Object
at.tuwien.ifs.somtoolbox.data.AbstractSOMLibSparseInputData
at.tuwien.ifs.somtoolbox.data.SOMLibSparseInputData
at.tuwien.ifs.somtoolbox.apps.helper.VectorFileToRandomAccessFileConverter
- All Implemented Interfaces:
- InputData
public class VectorFileToRandomAccessFileConverter
- extends SOMLibSparseInputData
Converts an input file to a binary/random access input file. his class customises the handling of data read from the
file by storing it in an Random Access File.
This is a specific, memory saving implementation, that could otherwise be handled with
InputDataFileFormatConverter
.
- Version:
- $Id: VectorFileToRandomAccessFileConverter.java 3589 2010-05-21 10:42:01Z mayer $
- Author:
- Rudolf Mayer
Field Summary |
private java.io.RandomAccessFile |
file
|
(package private) boolean |
headerWritten
|
Fields inherited from class at.tuwien.ifs.somtoolbox.data.AbstractSOMLibSparseInputData |
classInfo, contentType, dataNames, dim, ERROR_MESSAGE_FILE_FORMAT_CORRUPT, featureMatrixCols, featureMatrixRows, isNormalized, meanVector, mqe0, nameCache, numVectors, rand, source, templateVector |
Method Summary |
protected void |
initMatrix(boolean sparse)
|
static void |
main(java.lang.String[] args)
Starts the conversion |
protected void |
processLine(int documentIndex,
java.lang.String[] lineElements)
Stores the information read in the random access file. |
Methods inherited from class at.tuwien.ifs.somtoolbox.data.SOMLibSparseInputData |
addInstance, getDataAsMatrix, getDimensionality, getInputDatum, getInputVector, getValue, init, initDataStructures, mqe0, openFile, parse, parseDouble, readVectorFile, setLabel, setMatrixValue, subset |
Methods inherited from class at.tuwien.ifs.somtoolbox.data.AbstractSOMLibSparseInputData |
classInformation, create, dim, equals, getByNameDistanceSorted, getContentType, getData, getData, getDataIntervals, getDataSource, getDistanceMatrix, getDistances, getFeatureDensities, getFeatureMatrixColumns, getFeatureMatrixRows, getFileNameSuffix, getFormatName, getInputDatum, getInputDatum, getInputDatumIndex, getLabel, getLabels, getMaxValue, getMeanVector, getMeanVector, getMinValue, getNearestDistances, getNearestN, getNearestN, getNearestNUnsorted, getRandomInputDatum, initDistanceMatrix, isNormalizedToUnitLength, numVectors, setClassInfo, setTemplateVector, templateVector, transformValues |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
file
private java.io.RandomAccessFile file
headerWritten
boolean headerWritten
VectorFileToRandomAccessFileConverter
public VectorFileToRandomAccessFileConverter(java.lang.String inputVectorFile)
throws java.io.IOException
- Throws:
java.io.IOException
processLine
protected void processLine(int documentIndex,
java.lang.String[] lineElements)
throws java.lang.Exception
- Stores the information read in the random access file.
- Overrides:
processLine
in class SOMLibSparseInputData
- Parameters:
documentIndex
- the line indexlineElements
- the line elements, split by the delimeters
- Throws:
java.lang.Exception
initMatrix
protected void initMatrix(boolean sparse)
- Overrides:
initMatrix
in class SOMLibSparseInputData
main
public static void main(java.lang.String[] args)
throws java.io.IOException
- Starts the conversion
- Parameters:
args
- Needed program arguments:
- -v inputVectorFile, mandatory
- Throws:
java.io.IOException
- If the input vector file can't be read, or the output binary file can't be written.