analysis.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:NMT 作者: tuzhaopeng 项目源码 文件源码
def load_timings(path, y="cost2_p_expl", start=0, finish=3000000, window=100, hours=False):
    logging.debug("Loading timings from {}".format(path))
    tm = numpy.load(path)
    num_steps = min(tm['step'], finish)
    df = pandas.DataFrame({k : tm[k] for k in [y, 'time_step']})[start:num_steps]
    one_step = df['time_step'][-window:].median() / 3600.0
    print "Median time for one step is {} hours".format(one_step)
    if hours:
        df.index = (start + numpy.arange(0, df.index.shape[0])) * one_step
    return pandas.rolling_mean(df, window).iloc[window:]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号