本文整理汇总了Python中progressbar.DynamicMessage方法的典型用法代码示例。如果您正苦于以下问题:Python progressbar.DynamicMessage方法的具体用法?Python progressbar.DynamicMessage怎么用?Python progressbar.DynamicMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类progressbar
的用法示例。
在下文中一共展示了progressbar.DynamicMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_progress_bar
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import DynamicMessage [as 别名]
def create_progress_bar(dynamic_msg=None):
# Taken from Andreas Rueckle.
# usage:
# bar = _create_progress_bar('loss')
# L = []
# for i in bar(iterable):
# ...
# L.append(...)
#
# bar.dynamic_messages['loss'] = np.mean(L)
widgets = [
' [batch ', progressbar.SimpleProgress(), '] ',
progressbar.Bar(),
' (', progressbar.ETA(), ') '
]
if dynamic_msg is not None:
widgets.append(progressbar.DynamicMessage(dynamic_msg))
return progressbar.ProgressBar(widgets=widgets)
示例2: _make_progressbar
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import DynamicMessage [as 别名]
def _make_progressbar(self, N):
""" Returns a progressbar to use during optimization"""
if self.max_ind_shift is not None:
bar = progressbar.ProgressBar(widgets=[
' ', progressbar.DynamicMessage('ObjectiveFn'),
' ', progressbar.DynamicMessage('ObjectiveFn_Normalized'),
' Iteration: ',
' ', progressbar.Counter(), '/%d' % N,
' ', progressbar.AdaptiveETA(),
], max_value=N)
else:
bar = progressbar.ProgressBar(widgets=[
' ', progressbar.DynamicMessage('ObjectiveFn'),
' Iteration: ',
' ', progressbar.Counter(), '/%d' % N,
' ', progressbar.AdaptiveETA(),
], max_value=N)
return bar
示例3: _create_progress_bar
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import DynamicMessage [as 别名]
def _create_progress_bar(dynamic_msg=None):
widgets = [
' [batch ', progressbar.SimpleProgress(), '] ',
progressbar.Bar(),
' (', progressbar.ETA(), ') '
]
if dynamic_msg is not None:
widgets.append(progressbar.DynamicMessage(dynamic_msg))
return progressbar.ProgressBar(widgets=widgets)
示例4: make_widget
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import DynamicMessage [as 别名]
def make_widget():
widgets = [progressbar.Percentage(), ' ', progressbar.SimpleProgress(), ' ',
progressbar.Bar(left = '[', right = ']'), ' ', progressbar.ETA(), ' ',
progressbar.DynamicMessage('LOSS'), ' ', progressbar.DynamicMessage('PREC'), ' ',
progressbar.DynamicMessage('REC')]
bar = progressbar.ProgressBar(widgets = widgets)
return bar
### Find nearest timestamps ###
示例5: make_progressbar
# 需要导入模块: import progressbar [as 别名]
# 或者: from progressbar import DynamicMessage [as 别名]
def make_progressbar(max_value, show_output):
widgets = [
progressbar.Timer(format='Time: %(elapsed)s'),
' |',
progressbar.Percentage(),
progressbar.Bar(),
' ',
progressbar.ETA(),
]
if show_output:
widgets.extend([' | ', progressbar.DynamicMessage('loss')])
return progressbar.ProgressBar(max_value=max_value, widgets=widgets)