Training data used during network training: the TrainingData module

class nnfbp.TrainingData.HDF5TrainingData(data, nPoints, network, blockSize=10000, compression='blosc', comprl=9)[source]

Bases: nnfbp.TrainingData.TrainingData

Implementation of TrainingData that uses a HDF5 file to store data.

Parameters:
  • compression (string) – Which PyTables compression option to use.
  • comprl (int) – Which PyTables compression level to use.
addDataBlock(data, i)[source]
getDataBlock(i)[source]
normalizeData(minL, maxL, minIn, maxIn)[source]
class nnfbp.TrainingData.TrainingData(data, nPoints, network, blockSize=10000)[source]

Bases: object

Base object of a class that represents training or validation data used during training of a network.

An implementing class should define getDataBlock, addDataBlock and normalizeData methods. See, for example, HDF5TrainingData.

Parameters:
  • data (DataSet) – Dataset to pick pixels from. (see nnfbp.DataSet)
  • nPoints (int) – Number of pixels to pick.
  • blockSize (int) – Size of each data block.
addDataBlock(data, i)[source]

Add a block of data to the set.

Parameters:
  • data (numpy.ndarray) – Block of data to add.
  • i (int) – Position to add block to.
close()[source]

Close the underlying file.

getDataBlock(i)[source]

Get a block of data from the set.

Parameters:i (int) – Position of block to get.
Returns:numpy.ndarray – Block of data.
getMinMax()[source]

Returns the minimum and maximum values of each column of the entire set.

Returns:tuple with:
  • minLnumpy.ndarray with minimum value of each column except last.
  • maxLnumpy.ndarray with minimum value of each column except last.
  • minInfloat minimum values of last column.
  • maxInfloat maximum values of last column.
normalizeData(minL, maxL, minIn, maxIn)[source]

Normalize the set such that every column is in range (0,1), except for the last column, which will be normalized to (0.25,0.75). Parameters are like getMinMax().

Previous topic

The main module: the Network module

Next topic

A projector using the ASTRA toolbox: the ASTRAProjector module

This Page