template<typename Architecture_t, typename Layer_t = TLayer<Architecture_t>>
class TMVA::DNN::TNet< Architecture_t, Layer_t >
Generic neural network class.
This generic neural network class represents a concrete neural network through a vector of layers and coordinates the forward and backward propagation through the net.
The net takes as input a batch from the training data given in matrix form, with each row corresponding to a certain training event.
On construction, the neural network allocates all the memory required for the training of the neural net and keeps it until its destruction.
The Architecture type argument simply holds the architecture-specific data types, which are just the matrix type Matrix_t and the used scalar type Scalar_t.
- Template Parameters
-
Architecture | The Architecture type that holds the |
Layer_t | The type used for the layers. Can be either Layer<Architecture> or SharedWeightLayer<Architecture>. datatypes for a given architecture. |
Definition at line 49 of file Net.h.
|
| TNet () |
|
| TNet (const TNet &other) |
|
template<typename OtherArchitecture_t > |
| TNet (size_t batchSize, const TNet< OtherArchitecture_t > &) |
|
| TNet (size_t batchSize, size_t inputWidth, ELossFunction fJ, ERegularization fR=ERegularization::kNone, Scalar_t fWeightDecay=0.0) |
| Construct a neural net for a given batch size with given output function * and regularization. More...
|
|
void | AddLayer (size_t width, EActivationFunction f, Scalar_t dropoutProbability=1.0) |
| Add a layer of the given size to the neural net. More...
|
|
template<typename SharedLayer > |
void | AddLayer (SharedLayer &layer) |
| Add a layer which shares its weights with another TNet instance. More...
|
|
template<typename SharedLayer_t > |
void | AddLayer (SharedLayer_t &layer) |
|
void | Backward (const Matrix_t &X, const Matrix_t &Y, const Matrix_t &weights) |
| Compute the weight gradients in the net from the given training samples X and training labels Y. More...
|
|
void | Clear () |
| Remove all layers from the network. More...
|
|
TNet< Architecture_t, TSharedLayer< Architecture_t > > | CreateClone (size_t batchSize) |
| Create a clone that uses the same weight and biases matrices but potentially a difference batch size. More...
|
|
void | Forward (Matrix_t &X, bool applyDropout=false) |
| Forward a given input through the neural net. More...
|
|
size_t | GetBatchSize () const |
|
size_t | GetDepth () const |
|
size_t | GetInputWidth () const |
|
Layer_t & | GetLayer (size_t i) |
|
const Layer_t & | GetLayer (size_t i) const |
|
ELossFunction | GetLossFunction () const |
|
Scalar_t | GetNFlops () |
|
Matrix_t & | GetOutput () |
|
size_t | GetOutputWidth () const |
|
ERegularization | GetRegularization () const |
|
Scalar_t | GetWeightDecay () const |
|
void | Initialize (EInitialization m) |
| Initialize the weights in the net with the initialization method. More...
|
|
void | InitializeGradients () |
| Initialize the gradients in the net to zero. More...
|
|
LayerIterator_t | LayersBegin () |
| Iterator to the first layer of the net. More...
|
|
LayerIterator_t | LayersEnd () |
| Iterator to the last layer of the net. More...
|
|
Scalar_t | Loss (const Matrix_t &Y, const Matrix_t &weights, bool includeRegularization=true) const |
| Evaluate the loss function of the net using the activations that are currently stored in the output layer. More...
|
|
Scalar_t | Loss (Matrix_t &X, const Matrix_t &Y, const Matrix_t &weights, bool applyDropout=false, bool includeRegularization=true) |
| Propagate the input batch X through the net and evaluate the error function for the resulting activations of the output layer. More...
|
|
void | Prediction (Matrix_t &Y_hat, Matrix_t &X, EOutputFunction f) |
| Compute the neural network predictionion obtained from forwarding the batch X through the neural network and applying the output function f to the activation of the last layer in the network. More...
|
|
void | Prediction (Matrix_t &Y_hat, EOutputFunction f) const |
| Compute the neural network rediction obtained from applying the output function f to the activation of the last layer in the network. More...
|
|
void | Print () |
|
void | SetBatchSize (size_t batchSize) |
|
void | SetDropoutProbabilities (const std::vector< Double_t > &probabilities) |
|
void | SetInputWidth (size_t inputWidth) |
|
void | SetLossFunction (ELossFunction J) |
|
void | SetRegularization (ERegularization R) |
|
void | SetWeightDecay (Scalar_t weightDecay) |
|