当前位置:网站首页>CV review: softmax code implementation
CV review: softmax code implementation
2022-08-10 00:12:00 【pomelo33】
softmax function, also known as normalized exponential function.It is a binary classification function sigmoid in multi-classThe purpose of the generalization is to display the results of multi-classification in the form of probability.
1) Convert the forecast to a non-negative number
Convert a value to an exponential function
2) The sum of the probabilities of various prediction results is equal to 1
To ensure that the sum of the probabilities of each prediction result equals 1.We just need to normalize the transformed result.This is done by dividing the converted result by the sum of all the converted results, which can be understood as a percentage of the total converted results.This gives an approximate probability.
So the final formula of softmax is:
Code implementation:
Because the magnification of the exponential function is too obvious, if directly use the softmax calculation formulato implement the function, it will easily lead to data overflow (overflow).Therefore, we use its properties when implementing the function: first process the input data, and then use the calculation formula to calculate.Specifically, the implementation steps are as follows
边栏推荐
猜你喜欢
随机推荐
重装系统后新建文本文档打不开怎么办
leetcode:323. 无向图中连通分量的数目
B. Neighbor Grid
nvm下node安装;node环境变量配置
【技术分享】SLA(服务等级协议)原理与配置
[Microservice~Nacos] Nacos service provider and service consumer
How do task flow executors work?
typedef和#define的花里胡哨的用法
R语言将列表数据转化为向量数据(使用unlist函数将列表数据转化为向量数据)
charts.js插件实现的散点图样式
Analyze the Add() method in Fragment management from the source code
Activiti7审批流
Chatting embarrassing scenes, have you encountered it?Teach you to get the Doutu emoticon package with one click, and become a chat expert
毕昇编译器优化:Lazy Code Motion
OFDM 十六讲 7 - Inter-Symbol-Interference
2022-8-9 第六组 输入输出流
leetcode:321. 拼接最大数
D. Binary String To Subsequences
信息系统项目管理师---第十一章项目风险管理历年考题
leetcode:325. 和等于k的最长子数组长度