本文整理汇总了Python中Timer.Timer.getTimeStr方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.getTimeStr方法的具体用法?Python Timer.getTimeStr怎么用?Python Timer.getTimeStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer.Timer
的用法示例。
在下文中一共展示了Timer.getTimeStr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Timer import Timer [as 别名]
# 或者: from Timer.Timer import getTimeStr [as 别名]
def main(argv=None):
if argv is None:
argv = sys.argv[1:]
# Setup command line options
parser = OptionParser("usage: %prog [options]")
parser.add_option("-l", "--logdir", dest="logdir", default=".", help="log DIRECTORY (default ./)")
parser.add_option("-f", "--logfile", dest="logfile", default="project.log", help="log FILE (default project.log)")
parser.add_option("-v", "--loglevel", dest="loglevel", default="debug", help="logging level (debug, info, error)")
parser.add_option("-q", "--quiet", action="store_true", dest="quiet", help="do not log to console")
parser.add_option("-n", "--filequiet", action="store_true", dest="fquiet", help="do not log to file")
parser.add_option("-c", "--clean", dest="clean", action="store_true", default=False, help="remove old log file")
# Process command line options
(options, args) = parser.parse_args(argv)
# Setup logger format and output locations
logger = initialize_logging(options)
ti = Timer()
skip_events = []
skip_events = ['Container_Back_Loading','Refuelling','Container_Front_Loading','Container_Front_Unloading']
#skip_events.append('Handler_Deposites_Chocks')
#skip_events.append('Aircraft_Arrival')
#skip_events.append('Aircraft_Departure')
skip_events.append('Jet_Bridge_Positioning')
skip_events.append('Jet_Bridge_Parking')
#skip_events.append('VRAC_Back_Loading')
#skip_events.append('VRAC_Back_Unloading')
#skip_events.append('Push_Back_Positioning')
#skip_events = ['GPU_Arrival','Container_Back_Loading','Refuelling','Aircraft_Departure','Container_Front_Unloading']
data_path = '/usr/not-backed-up/cofriend/data/progol/clean_qtc/new_gt_with_zone_IBL_1protos/'
#file_name = 'msh2.p'
file_name = 'msh_all.p'
ins = pickle.load(open(data_path + file_name))
result = {}
#Visualize results as a table
pt = PT(["Event", "#pos examples", "TP", "FP"])
pt.align["Event"] = "l" # Left align event names
for event in ins.keys():
if event in skip_events:
continue
logger.info(event)
ti.start()
pos_score = 0
neg_score = 0
# Get negative test data
all_events = ins.keys()
all_events.remove(event)
for ev in skip_events:
all_events.remove(ev)
neg_test_data = [ins[i] for i in all_events]
neg_test_data = list(flatten(neg_test_data))
for train_data, pos_test_data in k_fold_cross_validation(ins[event], len(ins[event])):
[hyp, max_dis, avg_dis, min_dis] = train(train_data)
logger.info('-----------------')
logger.info('Avg: ' + repr(avg_dis) + ' Max: ' + repr(max_dis))
pos_score += test(hyp, max_dis, avg_dis, min_dis, pos_test_data, 'pos')
neg_score += test(hyp, max_dis, avg_dis, min_dis, neg_test_data, 'neg')
pt.add_row([event, len(ins[event]), float(pos_score)/len(ins[event]), float(neg_score)/len(ins[event])])
result[event] = [float(pos_score)/len(ins[event]), float(neg_score)/len(ins[event])]
ti.stop()
duration = ti.getTimeStr()
logger.info("Time Taken: " + duration)
logger.info(pt)