我在Brainscript中有以下网络。
self.tabBarController?.navigationItem.title = "My VC Title"
我的数据如下:
BrainScriptNetworkBuilder = {
inputDim = 4
labelDim = 1
embDim = 20
hiddenDim = 40
model = Sequential (
EmbeddingLayer {embDim} : # embedding
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
DenseLayer {labelDim} # output layer
)
# features
t = DynamicAxis{}
features = SparseInput {inputDim, tag="feature", dynamicAxis=t}
anomaly = Input {labelDim, tag="label"}
# model application
z = model (features)
zp = ReconcileDynamicAxis(z, anomaly)
# loss and metric
ce = CrossEntropyWithSoftmax (anomaly, zp)
errs = ClassificationError (anomaly, zp)
featureNodes = (features)
labelNodes = (anomaly)
criterionNodes = (ce)
evaluationNodes = (errs)
outputNodes = (z)
}
当我运行cntk命令尝试训练模型时,我得到以下异常。
发生异常:内部文件:Matrix.cpp行:1323功能:Microsoft :: MSR :: CNTK :: Matrix :: SetValue - >功能未实现。
我错过了什么?
答案 0 :(得分:2)
以下是一些建议:
首先,输入应与阅读器中描述的数据类型相匹配。因此,特征变量不应该是稀疏的,因为数据中的输入是密集的。
其次,LSTM将输出一系列输出,输出序列中的每个样本一个。你需要忽略除最后一个之外的所有内容。
model = Sequential ( DenseLayer {embDim} : # embedding
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
BS.Sequences.Last : #Use only the last in the LSTM sequence
DenseLayer {labelDim, activation=Sigmoid} # output layer
)