Logo ROOT  
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
18
19namespace TMVA {
20namespace DNN {
21
22template<typename AReal>
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
38template<typename AReal>
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
static void Softmax(TMatrixT< AReal > &YHat, const TMatrixT< AReal > &)
static void Sigmoid(TMatrixT< AReal > &B)
Int_t GetNrows() const
Int_t GetNcols() const
TMatrixT.
Definition TMatrixT.h:40
const Int_t n
Definition legend1.C:16
create variable transformations
TMarker m
Definition textangle.C:8
static uint64_t sum(uint64_t i)
Definition Factory.cxx:2345