ATLAS Offline Software
Loading...
Searching...
No Matches
TNeuralDataSet Class Reference

#include <TNeuralDataSet.h>

Collaboration diagram for TNeuralDataSet:

Public Member Functions

 TNeuralDataSet (Int_t aNumberOfPatterns=0, Int_t aNumberOfUnits=0)
virtual ~TNeuralDataSet (void)
 TNeuralDataSet (const TNeuralDataSet &)=delete
TNeuralDataSetoperator= (const TNeuralDataSet &)=delete
Int_t GetPatternsCount (void)
Int_t GetUnitsCount (void)
Double_t GetData (const Int_t aPattern, const Int_t aIndex)
void SetData (const Int_t aPattern, const Int_t aIndex, Double_t aValue)
Double_t GetEventWeight (const Int_t aPattern)
void SetEventWeight (const Int_t aPattern, Double_t aValue)
void Normalize (void)
void Randomize (void)
void Shuffle (Int_t aSeed=0)

Private Attributes

TMatrixD * mpData
TVectorD * mpWeights
TVectorD * mpNormFactors
TVectorD * mpShiftFactors

Detailed Description

Definition at line 25 of file TNeuralDataSet.h.

Constructor & Destructor Documentation

◆ TNeuralDataSet() [1/2]

TNeuralDataSet::TNeuralDataSet ( Int_t aNumberOfPatterns = 0,
Int_t aNumberOfUnits = 0 )

◆ ~TNeuralDataSet()

TNeuralDataSet::~TNeuralDataSet ( void )
virtual

Definition at line 23 of file TNeuralDataSet.cxx.

24{
25 // Default destructor
26 delete mpData;
27 delete mpWeights;
28 delete mpNormFactors;
29 delete mpShiftFactors;
30}
TVectorD * mpShiftFactors
TMatrixD * mpData
TVectorD * mpWeights
TVectorD * mpNormFactors

◆ TNeuralDataSet() [2/2]

TNeuralDataSet::TNeuralDataSet ( const TNeuralDataSet & )
delete

Member Function Documentation

◆ GetData()

Double_t TNeuralDataSet::GetData ( const Int_t aPattern,
const Int_t aIndex )
inline

Definition at line 68 of file TNeuralDataSet.h.

69{
70 // Returns the value of cell in the set specified by Pattern number and Unit index
71 return mpData->operator() ( aPattern, aIndex );
72}

◆ GetEventWeight()

Double_t TNeuralDataSet::GetEventWeight ( const Int_t aPattern)
inline

Definition at line 74 of file TNeuralDataSet.h.

75{
76 return mpWeights->operator() ( aPattern );
77}

◆ GetPatternsCount()

Int_t TNeuralDataSet::GetPatternsCount ( void )
inline

Definition at line 34 of file TNeuralDataSet.h.

34{ return mpData->GetNrows(); };

◆ GetUnitsCount()

Int_t TNeuralDataSet::GetUnitsCount ( void )
inline

Definition at line 36 of file TNeuralDataSet.h.

36{ return mpData->GetNcols(); };

◆ Normalize()

void TNeuralDataSet::Normalize ( void )

Definition at line 43 of file TNeuralDataSet.cxx.

44{
45 // Normalizes data
46 Double_t fMin;
47 Double_t fMax;
48 Double_t tmp;
49
50 for( UInt_t aUnitIndex = 0; aUnitIndex < this->GetUnitsCount(); aUnitIndex++ )
51 {
52 fMax = 0.0;
53 fMin = 0.0;
54 for( UInt_t aPatternIndex = 0; aPatternIndex < this->GetPatternsCount(); aPatternIndex++ )
55 {
56 tmp = this->GetData( aPatternIndex, aUnitIndex );
57 fMin = ( tmp < fMin )? tmp : fMin;
58 fMax = ( tmp > fMax )? tmp : fMax;
59 }
60
61 for( UInt_t aPatternIndex = 0; aPatternIndex < this->GetPatternsCount(); aPatternIndex++ )
62 {
63 tmp = this->GetData( aPatternIndex, aUnitIndex );
64 tmp = (tmp - fMin)/(fMax-fMin);
65 this->SetData( aPatternIndex, aUnitIndex, tmp );
66 }
67
68 mpNormFactors->operator() (aUnitIndex) = 1./(fMax-fMin);
69 mpShiftFactors->operator() (aUnitIndex) = -fMin/(fMax-fMin);
70
71 }
72}
Int_t GetUnitsCount(void)
void SetData(const Int_t aPattern, const Int_t aIndex, Double_t aValue)
Double_t GetData(const Int_t aPattern, const Int_t aIndex)
Int_t GetPatternsCount(void)

◆ operator=()

TNeuralDataSet & TNeuralDataSet::operator= ( const TNeuralDataSet & )
delete

◆ Randomize()

void TNeuralDataSet::Randomize ( void )

Definition at line 74 of file TNeuralDataSet.cxx.

75{
76 // Randomizes the data
77 TRandom3 r3;
78 for( Int_t i = 0; i < this->GetPatternsCount(); i ++ )
79 for( Int_t j = 0; j < this->GetUnitsCount(); j ++ )
80 {
81 this->SetData( i, j, r3.Gaus(0, 5) );
82 }
83}

◆ SetData()

void TNeuralDataSet::SetData ( const Int_t aPattern,
const Int_t aIndex,
Double_t aValue )

Definition at line 37 of file TNeuralDataSet.cxx.

38{
39 // Changes the value of cell in the set specified by Pattern number and Unit index
40 mpData->operator() ( aPattern, aIndex ) = aValue;
41}

◆ SetEventWeight()

void TNeuralDataSet::SetEventWeight ( const Int_t aPattern,
Double_t aValue )

Definition at line 32 of file TNeuralDataSet.cxx.

33{
34 mpWeights->operator() ( aPattern ) = aValue;
35}

◆ Shuffle()

void TNeuralDataSet::Shuffle ( Int_t aSeed = 0)

Definition at line 85 of file TNeuralDataSet.cxx.

86{
87 // Shuffles data
88 TRandom3 Random( aSeed );
89 Int_t j;
90 Double_t tmp;
91 Int_t a = this->GetPatternsCount() - 1;
92 for ( Int_t i = 0; i < this->GetPatternsCount(); i++ )
93 {
94 j = ( Int_t ) ( Random.Rndm() * a );
95 for( Int_t p = 0; p < this->GetUnitsCount(); p++ )
96 {
97 tmp = this->GetData( i, p );
98 this->SetData( i, p, this->GetData( j, p ) );
99 this->SetData( j, p, tmp );
100 }
101 tmp = this->GetEventWeight(i);
102 this->SetEventWeight(i,this->GetEventWeight(j));
103 this->SetEventWeight(j,tmp);
104 }
105}
static Double_t a
void SetEventWeight(const Int_t aPattern, Double_t aValue)
Double_t GetEventWeight(const Int_t aPattern)

Member Data Documentation

◆ mpData

TMatrixD* TNeuralDataSet::mpData
private

Definition at line 55 of file TNeuralDataSet.h.

◆ mpNormFactors

TVectorD* TNeuralDataSet::mpNormFactors
private

Definition at line 61 of file TNeuralDataSet.h.

◆ mpShiftFactors

TVectorD* TNeuralDataSet::mpShiftFactors
private

Definition at line 62 of file TNeuralDataSet.h.

◆ mpWeights

TVectorD* TNeuralDataSet::mpWeights
private

Definition at line 58 of file TNeuralDataSet.h.


The documentation for this class was generated from the following files: