当前位置:网站首页>Pytorch softmax regression

Pytorch softmax regression

2022-07-05 11:43:00 My abyss, my abyss

1、softmax The regression model

softmax The regression model is the same as linear regression, which makes linear superposition of input features and weights ,softmax The output number of regression is equal to the number of categories in the label . For example, in a problem of image classification , The input image is 2x2 Pixel image , Write them down as x1,x2,x3,x4. The real label of the corresponding data set is dog , cat , chicken , Write it down as o1,o2,o3.
Alt
Alt
softmax Regression is the same as linear regression , It's also a single-layer neural network . The output layer is also a full connection layer .

2、softmax operation

problem :1. The output range of the output layer is uncertain .2. It is difficult to measure the error between it and the real value
solve :softmax operation —— Change the output value to a positive value and a sum of 1 Probability distribution of
Alt
softmax Return to the sample i The vector calculation expression of the classification is :
Alt

3、 Cross entropy loss function (cross entropy)—— For classification models

 Insert picture description here

4、 summary

1、softmax Regression is applicable to multi classification problems , It USES softmax Calculate the probability distribution of the output class
2、softmax Regression is a single-layer neural network , The number of outputs is equal to the number of categories of the classification problem
3、 Cross entropy is suitable to measure the difference between two probability distributions

5、 Why? pytorch Not in the frame softmax module?

Alt

原网站

版权声明
本文为[My abyss, my abyss]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051134019325.html