28#ifndef ROOT_TMVA_MethodDL
29#define ROOT_TMVA_MethodDL
126 template <
typename Architecture_t,
typename Layer_t>
130 template <
typename Architecture_t,
typename Layer_t>
134 template <
typename Architecture_t,
typename Layer_t>
138 template <
typename Architecture_t,
typename Layer_t>
143 template <
typename Architecture_t,
typename Layer_t>
148 template <
typename Architecture_t,
typename Layer_t>
154 template <
typename Architecture_t,
typename Layer_t>
160 template <
typename Architecture_t>
165 template <
typename Architecture_t>
208 std::unique_ptr<MatrixImpl_t>
fYHat;
209 std::unique_ptr<DeepNetImpl_t>
fNet;
#define ClassDef(name, id)
The TCpu architecture class.
TCpuTensor< AReal > Tensor_t
TCpuBuffer< AReal > HostBuffer_t
TCpuMatrix< AReal > Matrix_t
Generic Deep Neural Network class.
Class that contains all the data information.
Virtual base Class for all MVA method.
virtual void ReadWeightsFromStream(std::istream &)=0
KeyValueVector_t & GetKeyValueSettings()
typename ArchitectureImpl_t::Tensor_t TensorImpl_t
size_t fBatchHeight
The height of the batch used to train the deep net.
void GetHelpMessage() const
DNN::ELossFunction fLossFunction
The loss function.
size_t GetInputDim() const
TString GetErrorStrategyString() const
std::vector< size_t > fInputShape
Contains the batch size (no.
void SetErrorStrategyString(TString errorStrategy)
TString fLayoutString
The string defining the layout of the deep net.
std::vector< TTrainingSettings > & GetTrainingSettings()
void SetInputDepth(int inputDepth)
Setters.
std::vector< size_t > GetInputShape() const
std::unique_ptr< MatrixImpl_t > fYHat
void Train()
Methods for training the deep learning network.
size_t GetBatchHeight() const
TString GetTrainingStrategyString() const
virtual std::vector< Double_t > GetMvaValues(Long64_t firstEvt, Long64_t lastEvt, Bool_t logProgress)
Evaluate the DeepNet on a vector of input values stored in the TMVA Event class Here we will evaluate...
TString fWeightInitializationString
The string defining the weight initialization method.
void ParseMaxPoolLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate max pool layer.
size_t fRandomSeed
The random seed used to initialize the weights and shuffling batches (default is zero)
virtual const std::vector< Float_t > & GetMulticlassValues()
TString fArchitectureString
The string defining the architecure: CPU or GPU.
void Init()
default initializations
void TrainDeepNet()
train of deep neural network using the defined architecture
const std::vector< TTrainingSettings > & GetTrainingSettings() const
DNN::EOutputFunction GetOutputFunction() const
void ParseDenseLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate dense layer.
UInt_t GetNumValidationSamples()
parce the validation string and return the number of event data used for validation
TString GetBatchLayoutString() const
void SetInputWidth(int inputWidth)
void SetArchitectureString(TString architectureString)
HostBufferImpl_t fXInputBuffer
size_t fBatchWidth
The width of the batch used to train the deep net.
size_t GetInputDepth() const
std::unique_ptr< DeepNetImpl_t > fNet
TString GetWeightInitializationString() const
TString GetInputLayoutString() const
void SetBatchHeight(size_t batchHeight)
size_t GetInputHeight() const
TString GetArchitectureString() const
void ParseBatchLayout()
Parse the input layout.
void ParseBatchNormLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate reshape layer.
void ReadWeightsFromStream(std::istream &)
void ReadWeightsFromXML(void *wghtnode)
TString fNumValidationString
The string defining the number (or percentage) of training data used for validation.
const KeyValueVector_t & GetKeyValueSettings() const
std::vector< std::map< TString, TString > > KeyValueVector_t
DNN::EOutputFunction fOutputFunction
The output function for making the predictions.
DNN::EInitialization fWeightInitialization
The initialization method.
void SetOutputFunction(DNN::EOutputFunction outputFunction)
size_t GetBatchDepth() const
void ParseRecurrentLayer(ERecurrentLayerType type, DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate rnn layer.
std::vector< TTrainingSettings > fTrainingSettings
The vector defining each training strategy.
size_t GetInputWidth() const
void SetInputShape(std::vector< size_t > inputShape)
DNN::ELossFunction GetLossFunction() const
TString fBatchLayoutString
The string defining the layout of the batch.
void SetWeightInitializationString(TString weightInitializationString)
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
Check the type of analysis the deep learning network can do.
size_t GetBatchSize() const
void ParseConvLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate convolutional layer.
void ParseReshapeLayer(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets, TString layerString, TString delim)
Pases the layer string and creates the appropriate reshape layer.
virtual const std::vector< Float_t > & GetRegressionValues()
TString fTrainingStrategyString
The string defining the training strategy.
void SetTrainingStrategyString(TString trainingStrategyString)
const Ranking * CreateRanking()
void SetLayoutString(TString layoutString)
const DeepNetImpl_t & GetDeepNet() const
typename ArchitectureImpl_t::HostBuffer_t HostBufferImpl_t
void SetBatchDepth(size_t batchDepth)
KeyValueVector_t fSettings
Map for the training strategy.
KeyValueVector_t ParseKeyValueString(TString parseString, TString blockDelim, TString tokenDelim)
Function for parsing the training settings, provided as a string in a key-value form.
void SetBatchWidth(size_t batchWidth)
std::vector< Double_t > PredictDeepNet(Long64_t firstEvt, Long64_t lastEvt, size_t batchSize, Bool_t logProgress)
perform prediction of the deep neural network using batches (called by GetMvaValues)
DNN::EInitialization GetWeightInitialization() const
void SetBatchSize(size_t batchSize)
void SetWeightInitialization(DNN::EInitialization weightInitialization)
TString GetLayoutString() const
size_t fBatchDepth
The depth of the batch used to train the deep net.
size_t GetBatchWidth() const
void AddWeightsXMLTo(void *parent) const
typename ArchitectureImpl_t::Matrix_t MatrixImpl_t
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
virtual ~MethodDL()
Virtual Destructor.
typename ArchitectureImpl_t::Scalar_t ScalarImpl_t
void ParseInputLayout()
Parse the input layout.
void FillInputTensor()
Get the input event tensor for evaluation Internal function to fill the fXInput tensor with the corre...
bool fBuildNet
Flag to control whether to build fNet, the stored network used for the evaluation.
void SetInputHeight(int inputHeight)
void CreateDeepNet(DNN::TDeepNet< Architecture_t, Layer_t > &deepNet, std::vector< DNN::TDeepNet< Architecture_t, Layer_t > > &nets)
After calling the ProcesOptions(), all of the options are parsed, so using the parsed options,...
TString fErrorStrategy
The string defining the error strategy for training.
void DeclareOptions()
The option handling methods.
TString fInputLayoutString
The string defining the layout of the input.
Ranking for variables in method (implementation)
EOptimizer
Enum representing the optimizer used for training.
EOutputFunction
Enum that represents output functions.
ERegularization
Enum representing the regularization type applied for a given layer.
ELossFunction
Enum that represents objective functions for the net, i.e.
create variable transformations
All of the options that can be specified in the training string.
std::map< TString, double > optimizerParams
DNN::EOptimizer optimizer
DNN::ERegularization regularization
std::vector< Double_t > dropoutProbabilities