Logo ROOT   6.07/09
Reference Guide
TestMinimizationCpu.cxx
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Simon Pfreundschuh
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 // Train the multi-threaded CPU implementation of DNNs on a random //
14 // linear mapping. In the linear case the minimization problem is //
15 // convex and the gradient descent training should converge to the //
16 // global minimum. //
17 /////////////////////////////////////////////////////////////////////
18 
19 #include <iostream>
21 #include "TestMinimization.h"
22 
23 using namespace TMVA::DNN;
24 
25 int main()
26 {
27 
28  std::cout << "Testing minimization: (single precision)" << std::endl;
29 
30  Double_t error = testMinimization<TCpu<Real_t>>();
31  std::cout << "Gradient Descent: Maximum relative error = " << error << std::endl;
32  if (error > 1e-3) {
33  return 1;
34  }
35 
36  error = testMinimizationMomentum<TCpu<Real_t>>();
37  std::cout << "Momentum: Maximum relative error = " << error << std::endl;
38  if (error > 1e-3) {
39  return 1;
40  }
41  std::cout << std::endl << "Testing minimization: (double precision)" << std::endl;
42 
43  error = testMinimization<TCpu<Double_t>>();
44  std::cout << "Gradient Descent: Maximum relative error = " << error << std::endl;
45  if (error > 1e-5) {
46  return 1;
47  }
48 
49  error = testMinimizationMomentum<TCpu<Double_t>>();
50  std::cout << "Momentum: Maximum relative error = " << error << std::endl;
51  if (error > 1e-5) {
52  return 1;
53  }
54  return 0;
55 }
Definition: Blas.h:58
int main()
double Double_t
Definition: RtypesCore.h:55
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630