千层面的卷积神经网络精度(回归与分类) [英] Convolutional Neural Network accuracy with Lasagne (regression vs classification)

查看:190
本文介绍了千层面的卷积神经网络精度(回归与分类)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经和Lasagne玩了一段时间了,以解决使用卷积神经网络进行二进制分类的问题.但是,尽管我在训练和验证损失上得到了不错的结果,但我的验证和测试准确性始终是恒定的(网络始终预测同一班级).

I have been playing with Lasagne for a while now for a binary classification problem using a Convolutional Neural Network. However, although I get okay(ish) results for training and validation loss, my validation and test accuracy is always constant (the network always predicts the same class).

我遇到了,千层面与我有同样的问题.他们的解决方案是像在Lasagne上使用Nolearn一样设置regression=True.

I have come across this, someone who has had the same problem as me with Lasagne. Their solution was to setregression=True as they are using Nolearn on top of Lasagne.

有人知道如何在Lasagne中设置相同的变量(因为我不想使用Nolearn)?除此之外,还有人解释为什么需要这样做吗?

Does anyone know how to set this same variable within Lasagne (as I do not want to use Nolearn)? Further to this, does anyone have an explanation as to why this needs to happen?

推荐答案

查看

Looking at the code of the NeuralNet class from nolearn, it looks like the parameter regression is used in various places, but most of the times it affects how the output value and loss are computed.

对于regression=False(默认值),网络以最大的概率输出类别,并使用分类交叉熵计算损失. 另一方面,在regression=True的情况下,网络输出每个类别的概率,并在输出矢量上计算平方误差的损失.

In case of regression=False (the default), the network outputs the class with the maximum probability, and computes the loss with the categorical crossentropy. On the other hand, in case of regression=True, the network outputs the probabilities of each class, and computes the loss with the squared error on the output vector.

我不是深度学习和CNN方面的专家,但这可能起作用的原因是在regression=True的情况下,并且如果误差梯度较小,则对网络参数进行小的更改可能不会更改预测的类和相关的损失,并可能导致算法认为"它已经收敛.但是,如果改为查看类概率,则参数的微小变化将影响概率以及由此产生的均方误差,并且网络将继续沿这条路径前进,最终可能会改变预测.

I am not an expert in deep learning and CNN, but the reason this may have worked is that in case of regression=True and if there is a small error gradient, applying small changes to the network parameters may not change the predicted class and the associated loss, and may lead the algorithm to "think" that it has converged. But if instead you look at the class probabilities, small parameter changes will affect the probabilities and the resulting mean squared error, and the network will continue down this path which may eventually change the predictions.

这只是一个猜测,如果不查看代码和数据集就很难分辨.

This is just a guess, it is hard to tell without seeing the code and the dataset.

这篇关于千层面的卷积神经网络精度(回归与分类)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆