当我使用tflearn时,模型的acc太低了

时间:2017-11-04 15:38:44

标签: tensorflow keras tflearn

有一个keras代码来自gtihub
https://github.com/uci-cbcl/DanQ/blob/master/DanQ_train.py
它的收益率接近0.97。

enter image description here

我想通过tflearn进行编码。 但是acc只有0.1左右。

enter image description here

模型简单,与keras相同 我研究了三天,但我不知道是什么错 这是我的代码:

from __future__ import division, print_function, absolute_import
from scipy.io import loadmat as load
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected, flatten,reshape
from tflearn.layers.conv import conv_1d, max_pool_1d
from tflearn.layers.recurrent import bidirectional_rnn,BasicLSTMCell,lstm,gru
from tflearn.layers.normalization import batch_normalization
from tflearn.layers.estimator import regression
import tflearn.optimizers
import numpy as np
# Data loading and preprocessing
train = load('train.mat')
X=train['trainxdata']
Y=train['traindata']

# Building convolutional network
X=np.transpose(X,axes=[0,2,1])
network = input_data(shape=[None, 1000, 4], name='input')
network=conv_1d(network,32,26,padding='valid',activation='relu',regularizer='L2')
network = max_pool_1d(network,kernel_size=13,strides=13)
batch_normalization(network)
network = dropout(network, 0.2)
network = flatten(network)
network = fully_connected(network, 925, activation='relu')
network = fully_connected(network, 919, activation='sigmoid')
network = regression(network, optimizer='Adam', learning_rate=0.01,loss='binary_crossentropy', name='target')
# Training
model = tflearn.DNN(network, tensorboard_verbose=0)
model.fit({'input': X}, {'target': Y}, n_epoch=20,
       validation_set=0.1, snapshot_step=60, show_metric=True, run_id='DanQ')}

我是外国学生,我很抱歉我的英语很差。 这是我第一次使用Stackoverflow。 谢谢你提出我的问题!

0 个答案:

没有答案