Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
818afb9
included xxhash.h
adi-sharma Jun 23, 2016
db6990f
added hashing initializations
adi-sharma Jun 24, 2016
efa2efb
added weightBucket
adi-sharma Jun 24, 2016
c821a57
edited applyWeights() without drop-out as an example
adi-sharma Jun 28, 2016
b6328a7
Updated all applyWeights() with HashedNets
adi-sharma Jul 1, 2016
a58ac1d
Update NeuralNet.h
adi-sharma Jul 1, 2016
c81f248
updated update() and Steepest Gradient Descent
adi-sharma Jul 1, 2016
96c8f42
Updated SGD operator() with HashedNets
adi-sharma Jul 1, 2016
0250775
updated weightDecay()
adi-sharma Jul 1, 2016
7c62f3b
updated weightDecay() with HashedNets
adi-sharma Jul 1, 2016
fe93bb2
Edited dropOutWeightFactor()
adi-sharma Jul 13, 2016
13d151a
Edited dropOutWeightFactor()
adi-sharma Jul 13, 2016
725bba3
Updated with HashedNets
adi-sharma Jul 18, 2016
4ec8917
Updated train() with HashedNets
adi-sharma Jul 18, 2016
b1caf73
Updated with complete HashedNets
adi-sharma Aug 23, 2016
c696958
Updated with complete HashedNets
adi-sharma Aug 23, 2016
8d6b2d4
Updated with Complete HashedNets
adi-sharma Aug 23, 2016
e277c73
Update MethodDNN.h
adi-sharma Aug 23, 2016
a820db6
Update NeuralNet.h
adi-sharma Aug 23, 2016
919a319
Updated with HashedNets
adi-sharma Aug 23, 2016
4d9e46c
Error corrections
adi-sharma Aug 24, 2016
3d7eec3
Error corrections NeuralNet.icc
adi-sharma Aug 24, 2016
d202ae1
Error corrections MethodDNN.cxx
adi-sharma Aug 24, 2016
52dc851
Successful compile
adi-sharma Aug 25, 2016
70484aa
Successful compile
adi-sharma Aug 25, 2016
6a0932f
Successful compile
adi-sharma Aug 25, 2016
4f5b919
Successful compile
adi-sharma Aug 25, 2016
96b29df
Successful build NeuralNet.h
adi-sharma Aug 25, 2016
f301784
Successful build NeuralNet.icc
adi-sharma Aug 25, 2016
9f1dce5
Successful build NeuralNet.cxx
adi-sharma Aug 25, 2016
f5e6943
Update NeuralNet.icc
adi-sharma Aug 26, 2016
c4f8749
Update NeuralNet.h
adi-sharma Aug 26, 2016
9637a69
Update MethodDNN.cxx
adi-sharma Aug 26, 2016
f62fcf2
Update NeuralNet.cxx
adi-sharma Aug 26, 2016
e48d24f
Made some logical changes in HashedNets
adi-sharma Aug 27, 2016
2bf3295
Made some logical changes in HashedNets
adi-sharma Aug 27, 2016
e048347
Update NeuralNet.icc
adi-sharma Aug 28, 2016
24c19c2
Production version v1.0
adi-sharma Aug 28, 2016
3c7f7ac
Production Version v1.0
adi-sharma Aug 28, 2016
e6332d5
Production Version v1.0
adi-sharma Aug 28, 2016
5c33612
Production Version v1.0
adi-sharma Aug 28, 2016
6eed664
Production Version v1.0
adi-sharma Aug 28, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Production Version v1.0
  • Loading branch information
adi-sharma authored Aug 28, 2016
commit 3c7f7ac59b9448c9ac61b9ea164931b8444db2cf
37 changes: 21 additions & 16 deletions tmva/tmva/inc/TMVA/NeuralNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace TMVA

// double gaussDoubl (edouble mean, double sigma);

const int BUCKET_SIZE = 8; // ------------------------------- Declare Bucket Size --------------------------------------------
// const int BUCKET_SIZE = 8; // ------------------------------- Declare Bucket Size --------------------------------------------
/*! \brief Hash initialization
*
*
Expand Down Expand Up @@ -268,12 +268,12 @@ namespace TMVA


template <typename ItSource, typename ItTarget>
void applyWeights (ItSource itSourceBegin, ItSource itSourceEnd, int itWeight, std::vector<double>& weightBucket, size_t layerNumber, ItTarget itTargetBegin, ItTarget itTargetEnd);
void applyWeights (ItSource itSourceBegin, ItSource itSourceEnd, int itWeight, std::vector<double>& weightBucket, size_t layerNumber, int BUCKET_SIZE, ItTarget itTargetBegin, ItTarget itTargetEnd);



template <typename ItSource, typename ItPrev, typename ItDrop>
void applyWeightsBackwards (ItSource itCurrBegin, ItSource itCurrEnd, int itWeight, std::vector<double>& weightBucket, size_t layerNumber, ItPrev itPrevBegin, ItPrev itPrevEnd, ItDrop itDrop);
void applyWeightsBackwards (ItSource itCurrBegin, ItSource itCurrEnd, int itWeight, std::vector<double>& weightBucket, size_t layerNumber, int BUCKET_SIZE, ItPrev itPrevBegin, ItPrev itPrevEnd, ItDrop itDrop);



Expand All @@ -292,7 +292,7 @@ namespace TMVA
void update (ItSource itSource, ItSource itSourceEnd,
ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd,
ItTargetGradient itTargetGradientBegin,
int itGradient, std::vector<double>& gradientBucket, size_t layerNumber);
int itGradient, std::vector<double>& gradientBucket, size_t layerNumber, int BUCKET_SIZE);



Expand All @@ -301,7 +301,7 @@ namespace TMVA
ItDelta itTargetDeltaBegin, ItDelta itTargetDeltaEnd,
ItTargetGradient itTargetGradientBegin,
int itGradient, std::vector<double>& gradientBucket,
int itWeight, std::vector<double>& weightBucket, double& factorWeightDecay, size_t layerNumber);
int itWeight, std::vector<double>& weightBucket, double& factorWeightDecay, size_t layerNumber, int BUCKET_SIZE);



Expand Down Expand Up @@ -376,7 +376,7 @@ namespace TMVA
* called
*/
template <typename Function, typename PassThrough>
double operator() (Function& fitnessFunction, std::vector<double>& weightBucket, PassThrough& passThrough, const size_t& numWeights, std::vector<int>& layerWeightNumber);
double operator() (Function& fitnessFunction, std::vector<double>& weightBucket, PassThrough& passThrough, const size_t& numWeights, std::vector<int>& layerWeightNumber, const int& BUCKET_SIZE);


double m_alpha; ///< internal parameter (learningRate)
Expand Down Expand Up @@ -420,7 +420,7 @@ namespace TMVA


template <typename EnumRegularization>
double weightDecay (double error, int currLayerWeightIndex, int nextLayerWeightIndex, std::vector<double>& weightBucket, double factorWeightDecay, EnumRegularization eRegularization, size_t layerNumber);
double weightDecay (double error, int currLayerWeightIndex, int nextLayerWeightIndex, std::vector<double>& weightBucket, double factorWeightDecay, EnumRegularization eRegularization, size_t layerNumber, int BUCKET_SIZE);



Expand Down Expand Up @@ -726,15 +726,15 @@ namespace TMVA


template <typename LAYERDATA>
void forward (const LAYERDATA& prevLayerData, LAYERDATA& currLayerData, std::vector<double>& weightBucket, size_t layerNumber);
void forward (const LAYERDATA& prevLayerData, LAYERDATA& currLayerData, std::vector<double>& weightBucket, size_t layerNumber, int BUCKET_SIZE);


template <typename LAYERDATA>
void backward (LAYERDATA& prevLayerData, LAYERDATA& currLayerData, std::vector<double>& weightBucket, size_t layerNumber);
void backward (LAYERDATA& prevLayerData, LAYERDATA& currLayerData, std::vector<double>& weightBucket, size_t layerNumber, int BUCKET_SIZE);


template <typename LAYERDATA>
void update (const LAYERDATA& prevLayerData, LAYERDATA& currLayerData, double factorWeightDecay, EnumRegularization regularization, std::vector<double>& weightBucket, std::vector<double>& gradientBucket, size_t layerNumber);
void update (const LAYERDATA& prevLayerData, LAYERDATA& currLayerData, double factorWeightDecay, EnumRegularization regularization, std::vector<double>& weightBucket, std::vector<double>& gradientBucket, size_t layerNumber, int BUCKET_SIZE);



Expand All @@ -752,7 +752,7 @@ namespace TMVA
*/
Settings (TString name,
size_t _convergenceSteps = 15, size_t _batchSize = 10, size_t _testRepetitions = 7,
double _factorWeightDecay = 1e-5, TMVA::DNN::EnumRegularization _regularization = TMVA::DNN::EnumRegularization::NONE,
double _factorWeightDecay = 1e-5, int _bucketSize = 8, TMVA::DNN::EnumRegularization _regularization = TMVA::DNN::EnumRegularization::NONE,
MinimizerType _eMinimizerType = MinimizerType::fSteepest,
double _learningRate = 1e-5, double _momentum = 0.3,
int _repetitions = 3,
Expand Down Expand Up @@ -788,6 +788,7 @@ namespace TMVA
double momentum () const { return fMomentum; } ///< get the momentum (e.g. for SGD)
int repetitions () const { return fRepetitions; } ///< how many steps have to be gone until the batch is changed
MinimizerType minimizerType () const { return fMinimizerType; } ///< which minimizer shall be used (e.g. SGD)
int bucketSize () const { return fBucketSize; } ///< Number of Weight Buckets per Layer



Expand Down Expand Up @@ -869,6 +870,7 @@ namespace TMVA
double fMomentum;
int fRepetitions;
MinimizerType fMinimizerType;
int fBucketSize;

size_t m_convergenceCount;
size_t m_maxConvergenceCount;
Expand Down Expand Up @@ -916,11 +918,11 @@ namespace TMVA
*/
ClassificationSettings (TString name,
size_t _convergenceSteps = 15, size_t _batchSize = 10, size_t _testRepetitions = 7,
double _factorWeightDecay = 1e-5, EnumRegularization _regularization = EnumRegularization::NONE,
double _factorWeightDecay = 1e-5, int _bucketSize = 8, EnumRegularization _regularization = EnumRegularization::NONE,
size_t _scaleToNumEvents = 0, MinimizerType _eMinimizerType = MinimizerType::fSteepest,
double _learningRate = 1e-5, double _momentum = 0.3, int _repetitions = 3,
bool _useMultithreading = true)
: Settings (name, _convergenceSteps, _batchSize, _testRepetitions, _factorWeightDecay,
: Settings (name, _convergenceSteps, _batchSize, _testRepetitions, _factorWeightDecay, _bucketSize,
_regularization, _eMinimizerType, _learningRate, _momentum, _repetitions, _useMultithreading)
, m_ams ()
, m_sumOfSigWeights (0)
Expand Down Expand Up @@ -1091,6 +1093,7 @@ namespace TMVA
: m_eErrorFunction (ModeErrorFunction::SUMOFSQUARES)
, m_sizeInput (0)
, m_layers ()
, m_bucketSize (8)
{
}

Expand All @@ -1102,6 +1105,7 @@ namespace TMVA
: m_eErrorFunction (other.m_eErrorFunction)
, m_sizeInput (other.m_sizeInput)
, m_layers (other.m_layers)
, m_bucketSize (other.m_bucketSize)
{
}

Expand Down Expand Up @@ -1166,13 +1170,13 @@ namespace TMVA

template <typename LayerContainer>
void forwardPattern (const LayerContainer& _layers,
std::vector<LayerData>& layerData, std::vector<double>& weightBucket) const;
std::vector<LayerData>& layerData, std::vector<double>& weightBucket, int BUCKET_SIZE) const;

size_t numWeights (size_t trainingStartLayer = 0) const; ///< returns the number of weights in this net
size_t numNodes (size_t trainingStartLayer = 0) const; ///< returns the number of nodes in this net

template <typename Weights>
std::vector<double> compute (const std::vector<double>& input, Weights& weightBucket) const; ///< compute the net with the given input and the given weights
std::vector<double> compute (const std::vector<double>& input, Weights& weightBucket, int BUCKET_SIZE) const; ///< compute the net with the given input and the given weights

template <typename PassThrough>
double operator() (PassThrough& settingsAndBatch, std::vector<double>& weightBucket) const; ///< execute computation of the DNN for one mini-batch (used by the minimizer); no computation of gradients
Expand Down Expand Up @@ -1273,7 +1277,7 @@ namespace TMVA

template <typename OutIterator>
void initializeWeights (WeightInitializationStrategy eInitStrategy,
OutIterator itWeight, std::vector<int>& layerWeightNumber); ///< initialize the weights with the given strategy
OutIterator itWeight, std::vector<int>& layerWeightNumber, int BUCKET_SIZE); ///< initialize the weights with the given strategy


protected:
Expand All @@ -1287,6 +1291,7 @@ namespace TMVA
size_t m_sizeInput; ///< input size of this DNN
size_t m_sizeOutput; ///< outut size of this DNN
std::vector<Layer> m_layers; ///< layer-structure-data
int m_bucketSize;
};


Expand Down