|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.tuwien.ifs.somtoolbox.data.AbstractSOMLibSparseInputData
at.tuwien.ifs.somtoolbox.data.RandomAccessFileSOMLibInputData
public class RandomAccessFileSOMLibInputData
Reads SOMLib input from a random access file.
RandomAccessFile
Field Summary | |
---|---|
private static int |
BYTES_CHAR
|
private static int |
BYTES_DOUBLE
|
private static int |
BYTES_INT
|
(package private) int |
headerOffset
|
private java.io.RandomAccessFile |
inputFile
|
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 |
Fields inherited from interface at.tuwien.ifs.somtoolbox.data.InputData |
---|
inputFileNameSuffix, MISSING_VALUE |
Constructor Summary | |
---|---|
RandomAccessFileSOMLibInputData(boolean norm,
java.util.Random rand,
TemplateVector tv,
SOMLibClassInformation clsInfo,
java.lang.String fileName)
|
|
RandomAccessFileSOMLibInputData(java.lang.String fileName)
|
Method Summary | |
---|---|
private static void |
compare(java.lang.String ascii,
java.lang.String binary)
Compare the ascii & binary version of some SOMLib input data. |
static java.lang.String |
getFileNameSuffix()
|
static java.lang.String |
getFormatName()
|
InputDatum |
getInputDatum(int d)
Get an input datum with a specified index. |
double[] |
getInputVector(int d)
Get the vector for the input datum of the specified index |
private int |
getOffset(int i)
|
private int |
getOffset(int i,
int j)
|
double |
getValue(int x,
int y)
Returns the value of the y-th feature of input vector x. |
static void |
main(java.lang.String[] args)
Main method for testing purposes, either writes & reads a random access file, or compares a random access file with an ascii version of the same input data. |
double |
mqe0(DistanceMetric metric)
Calculates the mean quantisation error of the top-level unit. |
private cern.colt.matrix.impl.SparseDoubleMatrix1D |
readVectorFromFile(int d)
|
InputData |
subset(java.lang.String[] names)
Gets a subset of this input data set. |
private static void |
test(java.lang.String fileName)
Create & read a random access file SOMLib input data. |
static void |
write(InputData data,
java.lang.String outputFile)
|
private static void |
writeContent(java.io.RandomAccessFile randomAccessFile,
double[][] data)
|
static boolean |
writeHeader(java.io.RandomAccessFile randomAccessFile,
int numVectors,
int dim)
|
static void |
writeVectorLabels(java.io.RandomAccessFile randomAccessFile,
java.lang.String[] labels)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int BYTES_CHAR
private static final int BYTES_INT
private static final int BYTES_DOUBLE
private java.io.RandomAccessFile inputFile
int headerOffset
Constructor Detail |
---|
public RandomAccessFileSOMLibInputData(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public RandomAccessFileSOMLibInputData(boolean norm, java.util.Random rand, TemplateVector tv, SOMLibClassInformation clsInfo, java.lang.String fileName) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public InputDatum getInputDatum(int d)
InputData
d
- the index of the input datum.
private cern.colt.matrix.impl.SparseDoubleMatrix1D readVectorFromFile(int d) throws java.io.IOException
java.io.IOException
public double[] getInputVector(int d)
InputData
private int getOffset(int i)
private int getOffset(int i, int j)
public double mqe0(DistanceMetric metric)
InputData
metric
- the metric to use for distance calculation.
public InputData subset(java.lang.String[] names)
InputData
names
- the label names of the desired subset data.
public double getValue(int x, int y)
InputData
public static void write(InputData data, java.lang.String outputFile) throws java.io.IOException
java.io.IOException
public static boolean writeHeader(java.io.RandomAccessFile randomAccessFile, int numVectors, int dim) throws java.io.IOException
java.io.IOException
private static void writeContent(java.io.RandomAccessFile randomAccessFile, double[][] data) throws java.io.IOException
java.io.IOException
public static void writeVectorLabels(java.io.RandomAccessFile randomAccessFile, java.lang.String[] labels) throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
private static void compare(java.lang.String ascii, java.lang.String binary) throws java.io.IOException
java.io.IOException
private static void test(java.lang.String fileName) throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
java.io.IOException
public static java.lang.String getFormatName()
public static java.lang.String getFileNameSuffix()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |