当前位置: 首页>>代码示例>>Python>>正文


Python Trainer.setBTreeName方法代码示例

本文整理汇总了Python中trainer.Trainer.setBTreeName方法的典型用法代码示例。如果您正苦于以下问题:Python Trainer.setBTreeName方法的具体用法?Python Trainer.setBTreeName怎么用?Python Trainer.setBTreeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trainer.Trainer的用法示例。


在下文中一共展示了Trainer.setBTreeName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: selection

# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import setBTreeName [as 别名]
#samples have a name, a color, a path, and a selection (not implemented yet for training)
#only the path is really relevant atm
cat='6j4t'

#change path if necessary
signal_test=Sample('t#bar{t}H test',ROOT.kBlue,"../../atlas-higgs-challenge-2014-v2.root",'') 
signal_train=Sample('t#bar{t}H training',ROOT.kGreen,"../../atlas-higgs-challenge-2014-v2.root",'')
background_test=Sample('t#bar{t} test',ROOT.kRed+1,"../../atlas-higgs-challenge-2014-v2.root",'')
background_train=Sample('t#bar{t} training',ROOT.kRed-1,"../../atlas-higgs-challenge-2014-v2.root",'')

#create trainer and set trainer options
trainer=Trainer(variables,addtional_variables)
#trainer.addSamples(signal_train,background_train)
trainer.addSamples(signal_train,background_train,signal_test,background_test) #add the sample defined above
trainer.setSTreeName('signal') # name of signaltree in files
trainer.setBTreeName('background') # name of backgroundtree in files
trainer.setReasonableDefaults() # set some configurations to reasonable values
trainer.setEqualNumEvents(True) # reweight events so that integral in training and testsample is the same
trainer.useTransformations(True) # faster this way
trainer.setVerbose(True) # no output during BDT training and testing
trainer.setWeightExpression('Weight')

#set BDT options
trainer.setBDTOption("NTrees=10")
trainer.setBDTOption("Shrinkage=0.01")
trainer.setBDTOption("nCuts=50")
trainer.setBDTOption("MaxDepth=2")

print trainer.best_variables
trainer.trainBDT(variables)
ROC, ksS, ksB, ROCT = trainer.evaluateLastTraining()
开发者ID:pekraem,项目名称:Datenanalyse,代码行数:33,代码来源:test.py


注:本文中的trainer.Trainer.setBTreeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。