在CNTK顺序机器学习模型的Branscript中定义种子值 [英] Defining a seed value in Branscripts for CNTK sequential machine learning models

查看:106
本文介绍了在CNTK顺序机器学习模型的Branscript中定义种子值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是对CNTK脑脚本的尊重.我经过[1]来找出是否有一个选项可以指定随机种子值,尽管我找不到任何选项(是的,有一个选项可以通过 ParameterTensor()设置随机种子"参数. 函数,但是如果我采用这种方法,则可能必须显式地分别初始化所有LSTM权重(为输入层门,忘记层门等定义单独的权重),而不是使用下面的模型序列.是否有其他选项可用于设置随机种子值,并保留以下RNN分层序列.

This is respect to CNTK brain scripts. I went through [1] to figure out whether there is an option to specify the random seed value, although I couldn't find any (Yes there is an option to set the 'random seed' parameter through the ParameterTensor() function, but if I followed that approach, I might have to explicitly initialize all the LSTM weights separately(defining separate weights for input layer gate, forget layer gate etc. ), instead of using the model sequence as below). Is there any other option available to set the random seed value, preserving the following RNN layered sequence.

nn_Train = {
  action = train
  BrainScriptNetworkBuilder = {
    model = Sequential (
      RecurrentLSTMLayer {$stateDim$, usePeepholes = true}:
      DenseLayer {$labelDim$, bias=false}                  
    )


    z = model (inputs)
    inputs=Input($inputDim$)  # features
    labels=Input($labelDim$)

    # loss and metric
    ce = SquareError(labels, z)

    # node assignment
    featureNodes    = (inputs)
    labelNodes      = (labels)
    criterionNodes  = (ce)
    evaluationNodes = (ce)
    outputNodes     = (z)
  }

[1] https://github.com/microsoft/cntk/wiki/Parameters-And-Constants#random-initialization

推荐答案

不幸的是,没有用于参数的全局随机种子选项.但是,您可以修改cntk.exe旁边的cntk.core.bs文件,其中定义了所有图层以支持所需图层的随机种子.

There isn't a global random seed option for parameters unfortunately. However, you can modify the cntk.core.bs file next to cntk.exe where all the layers are defined to support random seed for the layers you want.

这篇关于在CNTK顺序机器学习模型的Branscript中定义种子值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆