2020
10-08
10-08
keras在构建LSTM模型时对变长序列的处理操作
我就废话不多说了,大家还是直接看代码吧~print(np.shape(X))#(1920,45,20)X=sequence.pad_sequences(X,maxlen=100,padding='post')print(np.shape(X))#(1920,100,20)model=Sequential()model.add(Masking(mask_value=0,input_shape=(100,20)))model.add(LSTM(128,dropout_W=0.5,dropout_U=0.5))model.add(Dense(13,activation='softmax'))model.compile(loss='categorical_crossentropy',optimizer='adam',...
继续阅读 >