models.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:ContextMF 作者: lzheng21 项目源码 文件源码
def train(self, X_train, V, seed):
        X_train = sequence.pad_sequences(X_train, maxlen=self.max_len)
        np.random.seed(seed)
        X_train = np.random.permutation(X_train)
        np.random.seed(seed)
        V = np.random.permutation(V)

        print("Train...CNN module")
        #history = self.model.fit({'input': X_train, 'output': V},
        #                         verbose=0, batch_size=self.batch_size, nb_epoch=self.nb_epoch, shuffle=True, validation_split=0.1, callbacks=[EarlyStopping(monitor='val_loss', patience=0)])
        history = self.model.fit(X_train,y=V,batch_size=self.batch_size,nb_epoch=self.nb_epoch, shuffle=True, validation_split=0.1, callbacks=[EarlyStopping(monitor='val_loss', patience=0)])

        cnn_loss_his = history.history['loss']
        cmp_cnn_loss = sorted(cnn_loss_his)[::-1]
        if cnn_loss_his != cmp_cnn_loss:
            self.nb_epoch = 1
        return history
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号