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


Python Monitor.save方法代码示例

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


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

示例1: str

# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import save [as 别名]
        mtr.load()

    # then start train with function
    while True:
        epoch_no = 0
        while epoch_no < 100:
            epoch_no += 1
            print "training {} epoch, total data size is {}".format(epoch_no, str(len(data_generator.data)))
            data_generator.shuffle()
            cost_set = []
            index = 0
            for datapoint in data_generator.get_data_stream():
                index += 1
                train_data_sentence = datapoint[0]
                train_data_result = datapoint[1]
                train_data_image_feature = datapoint[2]
                output, cost = train_func(train_data_sentence, train_data_result, train_data_image_feature)
                cost_set.append(cost)

                sys.stderr.write("train {0} data, cost = {1} \r".format(index, cost))
                sys.stderr.flush()
                if args.show:
                    print cost
                    print data_generator.translate(output)
                    print data_generator.translate(train_data_sentence)
            batch_cost = sum(cost_set)/len(cost_set)
            print 'current batch cost = {}'.format(batch_cost)
            # save after trained
            mtr.save(batch_cost)
            print 'min batch cost = {}'.format(mtr.min_cost)
开发者ID:nathenqian,项目名称:neuralnetwork,代码行数:32,代码来源:model_rmsprop.py


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