ATLAS Offline Software
TNeuralDataSet.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Author: Vassil Verguilov 11/05/2006
6 
7 #ifndef __NEURALDATASET_
8 #define __NEURALDATASET_
9 
10 //______________________________________________________________________________
11 //
12 // TNeuralData
13 //
14 // This class is the base class for Neural Network Input/Output patterns
15 // It contains methods for manupulating the data such as Randomize(),
16 // Normalize(), Shuffle() and others.
17 //
18 //______________________________________________________________________________
19 //
20 
21 #include "TMatrixD.h"
22 #include "TVectorD.h"
23 
24 
26 {
27  public:
28  TNeuralDataSet( Int_t aNumberOfPatterns = 0, Int_t aNumberOfUnits = 0 );
29  virtual ~TNeuralDataSet( void );
30  TNeuralDataSet(const TNeuralDataSet &) = delete;
32 
33  // Returns the number of the patterns in set
34  Int_t GetPatternsCount( void ){ return mpData->GetNrows(); };
35  // Returns the number of the units in pattern
36  Int_t GetUnitsCount( void ){ return mpData->GetNcols(); };
37  // Returns the data in cell defined by pattern number and unit index in the pattern
38  Double_t GetData( const Int_t aPattern, const Int_t aIndex );
39  // Change the data in cell defined by pattern number and unit index in the pattern
40  void SetData( const Int_t aPattern, const Int_t aIndex, Double_t aValue );
41 
42  Double_t GetEventWeight( const Int_t aPattern );
43  void SetEventWeight( const Int_t aPattern, Double_t aValue );
44 
45  // Normalize all data
46  void Normalize( void );
47  // Randomizes the data
48  void Randomize( void );
49  // Shuffles the patterns
50  void Shuffle( Int_t aSeed = 0 );
51 
52  private:
53 
54  //data matrix
55  TMatrixD * mpData;
56 
57  //vector (dim= entries)
58  TVectorD * mpWeights;
59 
60  //vector (dim=variables)
61  TVectorD * mpNormFactors;
62  TVectorD * mpShiftFactors;
63 
64  ClassDef( TNeuralDataSet, 1 )
65 
66 };
67 
68 inline Double_t TNeuralDataSet::GetData( const Int_t aPattern, const Int_t aIndex )
69 {
70  // Returns the value of cell in the set specified by Pattern number and Unit index
71  return mpData->operator() ( aPattern, aIndex );
72 }
73 //______________________________________________________________________________
74 inline Double_t TNeuralDataSet::GetEventWeight( const Int_t aPattern )
75 {
76  return mpWeights->operator() ( aPattern );
77 }
78 //______________________________________________________________________________
79 
80 
81 
82 #endif
TNeuralDataSet
Definition: TNeuralDataSet.h:26
TNeuralDataSet::mpShiftFactors
TVectorD * mpShiftFactors
Definition: TNeuralDataSet.h:62
TNeuralDataSet::Randomize
void Randomize(void)
Definition: TNeuralDataSet.cxx:74
TNeuralDataSet::SetData
void SetData(const Int_t aPattern, const Int_t aIndex, Double_t aValue)
Definition: TNeuralDataSet.cxx:37
TNeuralDataSet::TNeuralDataSet
TNeuralDataSet(Int_t aNumberOfPatterns=0, Int_t aNumberOfUnits=0)
TNeuralDataSet::GetData
Double_t GetData(const Int_t aPattern, const Int_t aIndex)
Definition: TNeuralDataSet.h:68
TNeuralDataSet::Shuffle
void Shuffle(Int_t aSeed=0)
Definition: TNeuralDataSet.cxx:85
TNeuralDataSet::GetPatternsCount
Int_t GetPatternsCount(void)
Definition: TNeuralDataSet.h:34
TNeuralDataSet::~TNeuralDataSet
virtual ~TNeuralDataSet(void)
Definition: TNeuralDataSet.cxx:23
TNeuralDataSet::SetEventWeight
void SetEventWeight(const Int_t aPattern, Double_t aValue)
Definition: TNeuralDataSet.cxx:32
TNeuralDataSet::operator=
TNeuralDataSet & operator=(const TNeuralDataSet &)=delete
TNeuralDataSet::GetEventWeight
Double_t GetEventWeight(const Int_t aPattern)
Definition: TNeuralDataSet.h:74
TNeuralDataSet::mpNormFactors
TVectorD * mpNormFactors
Definition: TNeuralDataSet.h:61
TNeuralDataSet::Normalize
void Normalize(void)
Definition: TNeuralDataSet.cxx:43
TNeuralDataSet::mpData
TMatrixD * mpData
Definition: TNeuralDataSet.h:55
TNeuralDataSet::GetUnitsCount
Int_t GetUnitsCount(void)
Definition: TNeuralDataSet.h:36
TNeuralDataSet::TNeuralDataSet
TNeuralDataSet(const TNeuralDataSet &)=delete
TNeuralDataSet::mpWeights
TVectorD * mpWeights
Definition: TNeuralDataSet.h:58