15 def add_fbdtclassifier_training(path,
17 outputFileName='FBDTClassifier.dat',
21 samplesFileName='FBDTClassifier_samples.dat',
26 logLevel=b2.LogLevel.INFO,
28 """This function adds the FastBDTClassifierTraining-module to the given path and exposes all its parameters
29 @param path the path to which the module should be added
30 @param networkInputName parameter passed to the module
31 @param outputFileName the filename to which the FBDTClassifier will be stored
32 @param train actually do the training
33 @param nTrees number of trees in the module
34 @param treeDepth the number of layers in the trees
35 @param shrinkage the shrinkage parameter
36 @param randRatio the ratio of all samples used for training of each tree
37 @param logLevel the LogLevel of the module
38 @param dbgLvl the debugLevel of the module
40 fbdtTrainer = b2.register_module(
'FastBDTClassifierTraining')
41 fbdtTrainer.logging.log_level = logLevel
42 fbdtTrainer.logging.debug_level = dbgLvl
43 fbdtTrainer.param({
'networkInputName': networkInputName,
44 'outputFileName': outputFileName,
47 'treeDepth': treeDepth,
48 'shrinkage': shrinkage,
49 'randRatio': randRatio,
50 'storeSamples': storeSamples,
51 'useSamples': useSamples,
52 'samplesFileName': samplesFileName
55 path.add_module(fbdtTrainer)
58 def add_ml_threehitfilters(path,
60 fbdtFileName='FBDTClassifier.dat',
62 logLevel=b2.LogLevel.INFO,
64 """This function adds the MLSegmentNetworkProducerModule to the given path and exposes its parameters
65 @param path the path to which the module should be added
66 @param networkInputName parameter passed to the module
67 @param fbdtFileName the filename where the FBDT is stored
69 ml_segment = b2.register_module(
'MLSegmentNetworkProducer')
70 ml_segment.logging.log_level = logLevel
71 ml_segment.logging.debug_level = dbgLvl
72 ml_segment.param({
'networkInputName': networkInputName,
73 'FBDTFileName': fbdtFileName,
77 path.add_module(ml_segment)
80 def add_fbdtclassifier_analyzer(path,
84 outputFN='FBDTAnalyzer_out.root',
85 logLevel=b2.LogLevel.DEBUG,
87 """This function analyses all presented training and test samples and stores the outputs into a root file for later analysis
88 @param path the path to which the module should be added
89 @param fbdtFileName the filename of the FBDTClassifier
90 @param trainSamp the file name where the training samples are stored
91 @param testSamp the file name where the test smples are stored
92 @param outputFN the file name of the root file which is created
94 fbdtAnalyzer = b2.register_module(
'FastBDTClassifierAnalyzer')
95 fbdtAnalyzer.logging.log_level = logLevel
96 fbdtAnalyzer.logging.debug_level = dbgLvl
97 fbdtAnalyzer.param({
'fbdtFileName': fbdtFileName,
98 'testSamples': testSamp,
99 'trainSamples': trainSamp,
100 'outputFileName': outputFN
103 path.add_module(fbdtAnalyzer)