如何获取喀拉拉邦最后一层的历史?

时间:2019-05-17 02:13:30

标签: python keras neural-network deep-learning

在构建模型时,我想在每个时期获得softmax层的结果。

在这里,我想在以下模型的每个纪元的最后一层output中获得结果的历史记录。

class DNN(object):
    def __init__(self, config):
        self.max_features = config['max_features']
        self.num_batch = config['num_batch']
        self.maxlen = config['maxlen']
        self.embedding_dims = config['embedding_dims']
        self.lstm_dims = config['lstm_dims']
        self.hidden_dims = config['hidden_dims']
        self.epochs = config['epochs']
        self.classes = config['classes']
        self.optimizer = config['optimizer']

    def build_model(self):
        input = Input(shape=(self.maxlen))
        x = Dense(self.hidden_dims)(input)
        x = Activation('relu')(x)

        output = Dense(sef.classes)(x)
        output = Activation('softmax')(output)
        model = Model(inputs=input, outputs=output)
        model.compile(loss= 'categorical_crossentropy', optimizer= 'adam')

0 个答案:

没有答案