public class RandomAccessFileSOMLibInputData extends AbstractSOMLibSparseInputData
RandomAccessFile
Modifier and Type | Field and Description |
---|---|
private static int |
BYTES_CHAR |
private static int |
BYTES_DOUBLE |
private static int |
BYTES_INT |
(package private) int |
headerOffset |
private RandomAccessFile |
inputFile |
classInfo, contentType, dataNames, dim, ERROR_MESSAGE_FILE_FORMAT_CORRUPT, featureMatrixCols, featureMatrixRows, isNormalized, meanVector, mqe0, nameCache, numVectors, rand, source, templateVector
inputFileNameSuffix, MISSING_VALUE
Constructor and Description |
---|
RandomAccessFileSOMLibInputData(boolean norm,
Random rand,
TemplateVector tv,
SOMLibClassInformation clsInfo,
String fileName) |
RandomAccessFileSOMLibInputData(String fileName) |
Modifier and Type | Method and Description |
---|---|
private static void |
compare(String ascii,
String binary)
Compare the ascii & binary version of some SOMLib input data.
|
static String |
getFileNameSuffix() |
static 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(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(String[] names)
Gets a subset of this input data set.
|
private static void |
test(String fileName)
Create & read a random access file SOMLib input data.
|
static void |
write(InputData data,
String outputFile) |
private static void |
writeContent(RandomAccessFile randomAccessFile,
double[][] data) |
static boolean |
writeHeader(RandomAccessFile randomAccessFile,
int numVectors,
int dim) |
static void |
writeVectorLabels(RandomAccessFile randomAccessFile,
String[] labels) |
classInformation, create, dim, equals, getByNameDistanceSorted, getContentType, getData, getData, getDataIntervals, getDataSource, getDistanceMatrix, getDistances, getFeatureDensities, getFeatureMatrixColumns, getFeatureMatrixRows, getInputDatum, getInputDatum, getInputDatumIndex, getLabel, getLabels, getMaxValue, getMeanVector, getMeanVector, getMinValue, getNearestDistances, getNearestN, getNearestN, getNearestNUnsorted, getRandomInputDatum, initDistanceMatrix, isNormalizedToUnitLength, numVectors, setClassInfo, setTemplateVector, templateVector, transformValues
private static final int BYTES_CHAR
private static final int BYTES_INT
private static final int BYTES_DOUBLE
private RandomAccessFile inputFile
int headerOffset
public RandomAccessFileSOMLibInputData(String fileName) throws IOException
IOException
public RandomAccessFileSOMLibInputData(boolean norm, Random rand, TemplateVector tv, SOMLibClassInformation clsInfo, String fileName) throws IOException
IOException
public InputDatum getInputDatum(int d)
InputData
d
- the index of the input datum.private cern.colt.matrix.impl.SparseDoubleMatrix1D readVectorFromFile(int d) throws IOException
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(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, String outputFile) throws IOException
IOException
public static boolean writeHeader(RandomAccessFile randomAccessFile, int numVectors, int dim) throws IOException
IOException
private static void writeContent(RandomAccessFile randomAccessFile, double[][] data) throws IOException
IOException
public static void writeVectorLabels(RandomAccessFile randomAccessFile, String[] labels) throws IOException
IOException
public static void main(String[] args) throws IOException
IOException
private static void compare(String ascii, String binary) throws IOException
IOException
private static void test(String fileName) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static String getFormatName()
public static String getFileNameSuffix()