Defining a seed value in Branscripts for CNTK sequential machine learning models

陌路散爱 提交于 2019-12-12 23:34:32

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/43462506/defining-a-seed-value-in-branscripts-for-cntk-sequential-machine-learning-models

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!