为什么不使用输出张量的最大值代替Softmax函数? [英] why not use the max value of output tensor instead of Softmax Function?

查看:338
本文介绍了为什么不使用输出张量的最大值代替Softmax函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在图像一类分类上建立了CNN模型。
输出张量是一个包含65个元素的列表。我将此张量输入Softmax函数,并得到分类结果。
我认为这个输出张量的最大值是分类结果,为什么不使用这种方法来完成分类任务呢?

解决方案

Softmax用于


当您指出了为什么在最大函数上使用Softmax的原因之一是softmax函数在实数上是微分的,而max函数却不是。


编辑:


softmax函数还有其他一些属性,与max。相比,它适合用于神经网络。首先,它是max函数的软版本。假设神经网络的对数有4个输出[0.5,0.5,0.69,0.7]。 Hard max对于最大索引(在本例中为第4个索引)返回1,对于其他索引返回0。这导致信息丢失。
softmax的第二个重要属性是sofmax函数的输出在区间[0,1]中,并且这些值的总和等于1。因此,可以将softmax函数的输出解释为概率。这意味着输出可以被视为模型的置信度,可以将输入分类为每个输出类别之一。


I built a CNN model on images one-class classification. The output tensor is a list which has 65 elements. I make this tensor input to Softmax Function, and got the classified result. I think the max value in this output tensor is the classified result, why not use this way to do classification task? Just the Softmax Function can be taken the derivative easily?

解决方案

Softmax is used for multi-class classification. In multi-class class classification the model is expected to classify the input to single class with higher probability. Predicting with high probability enforces probabilities for other classes to be low.

As you stated one of the reason why one uses Softmax over max function is the softmax function is diffrential over Real Numbers and max function is not.

Edit:

There are some other properties of softmax function that makes it suitable to use for neural networks compared to max. Firstly it is soft version of max function. Let's say the logits of neural network has 4 outputs of [0.5, 0.5, 0.69, 0.7]. Hard max returns 1 for maximum index(in this case for 4th index) and 0 for other indexes. This results information loss. Second important property of softmax is the output of sofmax function are in interval [0,1] and the sum of these values is equal to 1. For this reason the output of softmax function can be interpreted as probability. This means output can be considered as the confidence of the model to classify inputs to one of each output classes.

这篇关于为什么不使用输出张量的最大值代替Softmax函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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