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


Python Trainer.tune方法代码示例

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


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

示例1: pre_train

# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import tune [as 别名]
def pre_train(data, das, nep = 600):
    x = data
    for ec, dc in das:
        dc.x(ec.y)
        tr = Trainer(ec.x, dc.y, src = x, dst = x, lrt = 0.005)
        tr.tune(nep, npt = 10)
        ec.x(x)
        x = ec.y().eval()
    del x
开发者ID:xiaoran831213,项目名称:az,代码行数:11,代码来源:test1.py

示例2: fine_tune

# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import tune [as 别名]
def fine_tune(data, das, nep = 600):
    x = data

    ## re-wire encoders and decoders
    ecs, dcs = zip(*das)
    sda = list(ecs) + list(reversed(dcs))
    for i, j in zip(sda[:-1], sda[1:]):
        j.x(i.y) # lower output -> higher input

    tr = Trainer(sda[0].x, sda[-1].y, src = data, dst = data, lrt = 0.0005)
    tr.tune(nep, npt= 10)
    return tr
开发者ID:xiaoran831213,项目名称:az,代码行数:14,代码来源:test1.py

示例3: pre_train

# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import tune [as 别名]
def pre_train(stk, dat, rate = 0.01, epoch = 1000):
    """
    pre-train each auto encoder in the stack
    """
    import time
    from trainer import Trainer
    tm = time.clock()

    print 'pre-train:', stk.dim; sys.stdout.flush()
    x = dat
    r = rate
    for ae in stk.sa:
        print ae.dim
        t = Trainer(ae, src = x, dst = x, lrt = r)
        t.tune(epoch, 20)
        x = ae.ec(x).eval()
        r = r * 2.0
    tm = time.clock() - tm
    print 'ran for {:.2f}m\n'.format(tm/60.); sys.stdout.flush()
开发者ID:xiaoran831213,项目名称:az,代码行数:21,代码来源:train_sda.py

示例4: fine_tune

# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import tune [as 别名]
def fine_tune(stk, dat, rate = 0.01, epoch = 50):
    """
    fine-tune the whole stack of autoencoders
    """
    import time
    from trainer import Trainer
    tm = time.clock()
    
    print 'find-tune:', stk.dim; sys.stdout.flush()
    x = dat
    dpt = len(stk)

    ## the training should be slower when parameters is more numerous
    t = Trainer(stk, src = x, dst = x, lrt = rate/ (2*dpt) )

    ## fine tune requires more steps when network goes deeper
    t.tune(epoch * 2 * dpt, epoch)
    tm = time.clock() - tm
    print 'ran for {:.2f}m\n'.format(tm/60.);  sys.stdout.flush()
开发者ID:xiaoran831213,项目名称:az,代码行数:21,代码来源:train_sda.py


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