小编Ran*_*amy的帖子

多标签分类角膜的怪异准确性

我有一个多标签分类问题,我使用了以下代码,但是在第一个时期,验证准确性跳升到99%,考虑到数据的复杂性,这是很奇怪的,因为输入特征是从初始模型(pool3:0)层中提取的2048个输入特征,标签为[1000],(这是文件的链接,其中包含功能和标签的示例:https : //drive.google.com/file/d/0BxI_8PO3YBPPYkp6dHlGeExpS1k/view?usp=sharing),我是否有此东西在这里做错了?

注意:标签为稀疏向量,仅包含1〜10项,因为1其余为零

model.compile(optimizer='adadelta', loss='binary_crossentropy', metrics=['accuracy']) 
Run Code Online (Sandbox Code Playgroud)

预测的输出为零!

在训练模型以干扰预测时,我做错了什么?

#input is the features file and labels file

def generate_arrays_from_file(path ,batch_size=100):
x=np.empty([batch_size,2048])
y=np.empty([batch_size,1000])
while True:
    f = open(path)
    i = 1  
    for line in f:
        # create Numpy arrays of input data
        # and labels, from each line in the file
        words=line.split(',')
        words=map(float, words[1:])
        x_= np.array(words[0:2048])
        y_=words[2048:]
        y_= np.array(map(int,y_))
        x_=x_.reshape((1, -1))
        #print np.squeeze(x_)
        y_=y_.reshape((1,-1))
        x[i]= x_
        y[i]=y_
        i += 1
        if i == batch_size:
            i=1
            yield (x, y)

    f.close() …
Run Code Online (Sandbox Code Playgroud)

machine-learning sparse-matrix multilabel-classification keras

7
推荐指数
1
解决办法
1813
查看次数