This commit is contained in:
Frank Seide 2016-08-24 18:15:09 -07:00
Родитель 9e73e6fda5
Коммит 769b2602a2
7 изменённых файлов: 32 добавлений и 31 удалений

Просмотреть файл

@ -46,11 +46,12 @@ DenseLayer{outDim, bias = true, activation=(x=>x), init='heNormal', initValueSca
# EmbeddingLayer -- create a linear embedding layer
EmbeddingLayer {outDim, # dimension of embedding
init='heNormal', initValueScale=1,
embeddingPath = '', transpose = false} = # load a fixed embedding from a path instead
{
shape = if transpose then (Inferred : outDim) else (outDim : Inferred)
E = if embeddingPath == ''
then ParameterTensor {shape, init='heNormal'} # learnable
then ParameterTensor {shape, init=init, initValueScale=initValueScale} # learnable
else ParameterTensor {shape, initFromFilePath = embeddingPath, learningRateMultiplier = 0} # fixed from file
TimesOp = if transpose then TransposeTimes else Times
apply (x) = TimesOp (E, x) # x is expected to be sparse one-hot

Просмотреть файл

@ -21,9 +21,9 @@ TrainTagger = {
hiddenDim = 300
model = Sequential (
EmbeddingLayer {embDim} : # embedding
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
DenseLayer {labelDim, initValueScale=7} # output layer
EmbeddingLayer {embDim, init='uniform'} : # embedding
RecurrentLSTMLayer {hiddenDim, goBackwards=false, init='uniform'} : # LSTM
DenseLayer {labelDim, init='uniform', initValueScale=7} # output layer
)
# features

Просмотреть файл

@ -20,11 +20,11 @@ TrainTagger = {
hiddenDim = 300
model = Sequential (
EmbeddingLayer {embDim} : # embedding
EmbeddingLayer {embDim, init='uniform'} : # embedding
BatchNormalizationLayer {normalizationTimeConstant=2048} : ##### added
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
RecurrentLSTMLayer {hiddenDim, goBackwards=false, init='uniform'} : # LSTM
BatchNormalizationLayer {normalizationTimeConstant=2048} : ##### added
DenseLayer {labelDim, initValueScale=7} # output layer
DenseLayer {labelDim, init='uniform', initValueScale=7} # output layer
)
# features

Просмотреть файл

@ -22,12 +22,12 @@ TrainTagger = {
LookaheadLayer (x) = Splice (x : FutureValue (0, x, defaultHiddenActivation=0))
model = Sequential (
EmbeddingLayer {embDim} : # embedding
EmbeddingLayer {embDim, init='uniform'} : # embedding
LookaheadLayer : ##### added
BatchNormalizationLayer {normalizationTimeConstant=2048} :
RecurrentLSTMLayer {hiddenDim, goBackwards=false} : # LSTM
RecurrentLSTMLayer {hiddenDim, goBackwards=false, init='uniform'} : # LSTM
BatchNormalizationLayer {normalizationTimeConstant=2048} :
DenseLayer {labelDim, initValueScale=7} # output layer
DenseLayer {labelDim, init='uniform', initValueScale=7} # output layer
)
# features

Просмотреть файл

@ -20,17 +20,17 @@ TrainTagger = {
hiddenDim = 150
BiRecurrentLSTMLayer {outDim} = {
F = RecurrentLSTMLayer {outDim, goBackwards=false}
G = RecurrentLSTMLayer {outDim, goBackwards=true}
F = RecurrentLSTMLayer {outDim, goBackwards=false, init='uniform'}
G = RecurrentLSTMLayer {outDim, goBackwards=true, init='uniform'}
apply (x) = Splice (F(x):G(x))
}.apply
model = Sequential (
EmbeddingLayer {embDim} :
EmbeddingLayer {embDim, init='uniform'} :
BatchNormalizationLayer {normalizationTimeConstant=2048} :
BiRecurrentLSTMLayer {hiddenDim} :
BatchNormalizationLayer {normalizationTimeConstant=2048} :
DenseLayer {labelDim, initValueScale=7}
DenseLayer {labelDim, init='uniform', initValueScale=7}
)
# features

Просмотреть файл

@ -20,17 +20,17 @@ TrainTagger = {
hiddenDim = 150
BiRecurrentLSTMLayer {outDim} = {
F = RecurrentLSTMLayer {outDim, goBackwards=false}
G = RecurrentLSTMLayer {outDim, goBackwards=true}
F = RecurrentLSTMLayer {outDim, goBackwards=false, init='uniform'}
G = RecurrentLSTMLayer {outDim, goBackwards=true, init='uniform'}
apply (x) = Splice (BS.Sequences.Last(F(x)):BS.Sequences.First(G(x)))
}.apply
model = Sequential (
EmbeddingLayer {embDim} :
EmbeddingLayer {embDim, init='uniform'} :
BatchNormalizationLayer {normalizationTimeConstant=2048} :
BiRecurrentLSTMLayer {hiddenDim} :
BatchNormalizationLayer {normalizationTimeConstant=2048} :
DenseLayer {intentDim, initValueScale=7}
DenseLayer {intentDim, init='uniform', initValueScale=7}
)
# features