org.encog.ml.data.buffer
Class EncogEGBFile
- java.lang.Object
-
- org.encog.ml.data.buffer.EncogEGBFile
-
public class EncogEGBFile extends java.lang.ObjectUsed to access an Encog Binary Training file (*.EGB).
-
-
Field Summary
Fields Modifier and Type Field and Description static intDOUBLE_SIZEThe size of a double.static intHEADER_SIZEThe size of the file header.
-
Constructor Summary
Constructors Constructor and Description EncogEGBFile(java.io.File theFile)Construct an EGB file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddColumn(int col, boolean isInput)Add a column.voidaddRow(int row)Add a row.voidclose()Close the file.voidcreate(int theInputCount, int theIdealCount)Create a new RGB file.voiddeleteCol(int col)Delete a column.voiddeleteRow(int row)Delete a row.java.nio.channels.FileChannelgetFc()java.io.FilegetFile()java.nio.ByteBuffergetHeaderBuffer()intgetIdealCount()intgetInputCount()intgetNumberOfRecords()java.io.RandomAccessFilegetRaf()java.nio.ByteBuffergetRecordBuffer()intgetRecordCount()intgetRecordSize()voidopen()OPen an existing EGB file.doubleread()Read a single double.voidread(double[] d)Read an array of doubles.voidread(int row, double[] d)Read a double array at the specified record.doubleread(int row, int col)Read a row and column.voidsetLocation(int row)Set the current location to the specified row.voidwrite(byte b)Write a byte.voidwrite(double d)voidwrite(double[] v)Write an array.voidwrite(int row, double[] v)Write an array at the specified record.voidwrite(int row, int col, double v)Write the specified row and column.
-
-
-
Field Detail
-
DOUBLE_SIZE
public static final int DOUBLE_SIZE
The size of a double.- See Also:
- Constant Field Values
-
HEADER_SIZE
public static final int HEADER_SIZE
The size of the file header.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EncogEGBFile
public EncogEGBFile(java.io.File theFile)
Construct an EGB file.- Parameters:
theFile- The file.
-
-
Method Detail
-
addColumn
public void addColumn(int col, boolean isInput)Add a column.- Parameters:
col- THe column to add.isInput- Is this an input column?
-
addRow
public void addRow(int row)
Add a row.- Parameters:
row- Where to add the row.
-
close
public void close()
Close the file.
-
create
public void create(int theInputCount, int theIdealCount)Create a new RGB file.- Parameters:
theInputCount- The input count.theIdealCount- The ideal count.
-
deleteCol
public void deleteCol(int col)
Delete a column.- Parameters:
col- The column to delete.
-
deleteRow
public void deleteRow(int row)
Delete a row.- Parameters:
row- The row to delete.
-
getFc
public java.nio.channels.FileChannel getFc()
- Returns:
- the fc
-
getFile
public java.io.File getFile()
- Returns:
- the file
-
getHeaderBuffer
public java.nio.ByteBuffer getHeaderBuffer()
- Returns:
- the headerBuffer
-
getIdealCount
public int getIdealCount()
- Returns:
- the idealCount
-
getInputCount
public int getInputCount()
- Returns:
- the inputCount
-
getNumberOfRecords
public int getNumberOfRecords()
- Returns:
- the numberOfRecords
-
getRaf
public java.io.RandomAccessFile getRaf()
- Returns:
- the raf
-
getRecordBuffer
public java.nio.ByteBuffer getRecordBuffer()
- Returns:
- the recordBuffer
-
getRecordCount
public int getRecordCount()
- Returns:
- the recordCount
-
getRecordSize
public int getRecordSize()
- Returns:
- the recordSize
-
open
public void open()
OPen an existing EGB file.
-
read
public double read()
Read a single double.- Returns:
- The double read.
-
read
public void read(double[] d)
Read an array of doubles.- Parameters:
d- The array to read into.
-
read
public void read(int row, double[] d)Read a double array at the specified record.- Parameters:
row- The record to read.d- The array to read into.
-
read
public double read(int row, int col)Read a row and column.- Parameters:
row- The row to read.col- The column to read.- Returns:
- The value read.
-
setLocation
public void setLocation(int row)
Set the current location to the specified row.- Parameters:
row- The row.
-
write
public void write(byte b)
Write a byte.- Parameters:
b- The byte to write.
-
write
public void write(double[] v)
Write an array.- Parameters:
v- The array to write.
-
write
public void write(int row, double[] v)Write an array at the specified record.- Parameters:
row- The record to write.v- The array to write.
-
write
public void write(int row, int col, double v)Write the specified row and column.- Parameters:
row- The row.col- The column.v- The value.
-
write
public void write(double d)
-
-
DMelt 3.0 © DataMelt by jWork.ORG