from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.layers.recurrent import LSTM
https://blog.csdn.net/marsjhao/article/details/68490105
model= Sequential()
model.add(*)
#Configures the learning process.
model.compile(self, optimizer, loss, metrics=None, sample_weight_mode=None, weighted_metrics=None)
#Trains the model for a fixed number of epochs
model.fit(self, x, y, batch_size=32, epochs=10, verbose=1, callbacks=None, validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0)
#Computes the loss on some input data, batch by batch.
model.evaluate(self, x, y, batch_size=32, verbose=1, sample_weight=None)
#Generates output predictions for the input samples.
model.predict(self, x, batch_size=32, verbose=0)
-
Activation(‘softmax’)
版本需要是keras=2.1不会报错axis缺失
model.add(Activation('softmax'))
- LSTM
keras.layers.recurrent.LSTM(units, activation='tanh', recurrent_activation='hard_sigmoid', use_bias=True, kernel_initializer='glorot_uniform', recurrent_initializer='orthogonal', bias_initializer='zeros', unit_forget_bias=True, kernel_regularizer=None, recurrent_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, recurrent_constraint=None, bias_constraint=None, dropout=0.0, recurrent_dropout=0.0, implementation=1, return_sequences=False, return_state=False, go_backwards=False, stateful=False, unroll=False)