ROOT
v6-24
Reference Guide
Loading...
Searching...
No Matches
OutputFunctions.hxx
Go to the documentation of this file.
1
// @(#)root/tmva/tmva/dnn:$Id$
2
// Author: Simon Pfreundschuh 11/07/16
3
4
/*************************************************************************
5
* Copyright (C) 2016, Simon Pfreundschuh *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
////////////////////////////////////////////////////////////////
13
// Explicit instantiation of the TReference architecture class //
14
// template for Double_t scalar types. //
15
////////////////////////////////////////////////////////////////
16
17
#include "
TMVA/DNN/Architectures/Reference.h
"
18
19
namespace
TMVA
{
20
namespace
DNN {
21
22
template
<
typename
AReal>
23
void
TReference<AReal>::Sigmoid
(
TMatrixT<AReal>
& B,
24
const
TMatrixT<AReal>
& A)
25
{
26
size_t
m
,
n
;
27
m
= A.
GetNrows
();
28
n
= A.
GetNcols
();
29
30
for
(
size_t
i = 0; i <
m
; i++) {
31
for
(
size_t
j = 0; j <
n
; j++) {
32
AReal sig = 1.0 / (1.0 + std::exp(-A(i,j)));
33
B(i,j) = sig;
34
}
35
}
36
}
37
38
template
<
typename
AReal>
39
void
TReference<AReal>::Softmax
(
TMatrixT<AReal>
& B,
40
const
TMatrixT<AReal>
& A)
41
{
42
size_t
m
,
n
;
43
m
= A.
GetNrows
();
44
n
= A.
GetNcols
();
45
46
for
(
size_t
i = 0; i <
m
; i++) {
47
AReal
sum
= 0.0;
48
for
(
size_t
j = 0; j <
n
; j++) {
49
sum
+=
exp
(A(i,j));
50
}
51
for
(
size_t
j = 0; j <
n
; j++) {
52
B(i,j) =
exp
(A(i,j)) /
sum
;
53
}
54
}
55
}
56
57
}
// namespace TMVA
58
}
// namespace DNN
Reference.h
exp
double exp(double)
TMVA::DNN::TReference::Softmax
static void Softmax(TMatrixT< AReal > &YHat, const TMatrixT< AReal > &)
Definition
OutputFunctions.hxx:39
TMVA::DNN::TReference::Sigmoid
static void Sigmoid(TMatrixT< AReal > &B)
TMatrixTBase::GetNrows
Int_t GetNrows() const
Definition
TMatrixTBase.h:123
TMatrixTBase::GetNcols
Int_t GetNcols() const
Definition
TMatrixTBase.h:126
TMatrixT
TMatrixT.
Definition
TMatrixT.h:39
n
const Int_t n
Definition
legend1.C:16
TMVA
create variable transformations
Definition
GeneticMinimizer.h:22
m
auto * m
Definition
textangle.C:8
sum
static uint64_t sum(uint64_t i)
Definition
Factory.cxx:2345
tmva
tmva
src
DNN
Architectures
Reference
OutputFunctions.hxx
ROOT v6-24 - Reference Guide Generated on Tue Aug 22 2023 03:06:52 (GVA Time) using Doxygen 1.9.8