当前位置:网站首页>硬阈值(Hard Thresholding)函数解读[通俗易懂]
硬阈值(Hard Thresholding)函数解读[通俗易懂]
2022-07-01 12:23:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
题目:硬阈值(Hard Thresholding)函数解读
1、硬阈值(Hard Thresholding)函数的符号
硬阈值(Hard Thresholding)并没有软阈值(Soft Thresholding)那么常见,这可能是因为硬阈值解决的问题是非凸的原因吧。硬阈值与软阈值由同一篇文献提出,硬阈值公式参见文献【1】的式( 11):
第一次邂逅硬阈值(HardThresholding)是在文献【2】中:
在查询软阈值(Soft Thresholding)的过程中,搜到了文献【3】,进而看到了提到了文献【4】:
文献【4】中提到的Fig 1如图所示:
硬阈值的符号到底表示什么意思呢?以文献【1】符号为例,清晰一点来说就是这样的:
这里w是变量,λ是阈值。
2、硬阈值(HardThresholding)函数的作用
弄清楚了硬阈值(HardThresholding)的符号表示以后,接下来说一说它的作用。这里主要是参考了软阈值的推导过程,然后自己经过一番琢磨和推导而得。
硬阈值(HardThresholding)可以求解如下优化问题:
其中:
||X||0是求向是向量X的零范数,即向量X中非零元素的个数。根据范数的定义,可以将上面优化问题的目标函数拆开:
其中拆分项中符号|x|0的意思是
现在,我们可以通过求解N个独立的形如函数
的优化问题,来求解这个问题。将f(x)进一步写为:
对于x≠0部分,我们知道它的最小值在x=b处取得,最小值为λ。现在的问题是λ与b2到底谁更小?最小者将是函数f(x)的最小值。求解不等式b2>λ可得
此时最小值在x=0处取得;
求解不等式b2<λ可得
此时最小值在x=b处取得;
因此
与前面的硬阈值(Hard Thresholding)对比一下,发现了么?若将上式中的b视为变量,sqrt(λ)视为阈值,上式即为硬阈值(Hard Thresholding)的公式。
至此,我们可以得到优化问题
的解为
注:该式为硬阈值(Hard Thresholding)的矩阵形式,这里的B是一个向量,应该是逐个元素分别执行硬阈值函数;。
3、硬阈值(HardThresholding)的变形
当优化问题变为
因为对目标函数乘一个常系数不影响极值点的获得,所以可等价为优化问题
此时的解为
。
4、硬阈值(Hard Thresholding)的MATLAB代码
硬阈值(Hard Thresholding)的函数代码可以写成专门针对优化问题
MATLAB函数代码如下(参考了文献【5】倒数第2页):
function [ hard_thresh ] = hardthresholding( b,lambda )
sel = (abs(b)>sqrt(lambda));
hard_thresh = b.*sel;
end一定要注意:这种写法是针对最开始的优化问题:
但我个人感觉更应该写成这种通用形式:
function [ x ] = hard( b,T )
sel = (abs(b)>T);
x = b.*sel;
end如此之后,若要解决优化问题
只需调用hard(B, sqrt(λ))即可;若要解决优化问题
只需调用hard(B, sqrt(2*λ))即可。
5、硬阈值(HardThresholding)测试代码
硬阈值(Hard Thresholding)要解决的优化问题目标函数是非凸的,不太常见,手边目前没有其它函数求解这个问题,因此测试代码只能测一下这个函数编写的正确与否了:
clear all;close all;clc;
b = [-0.8487 -0.3349 0.5528 1.0391 -1.1176]';
lambda = 0.5;
x1=hardthresholding(b,lambda)
x2=hard(b,sqrt(lambda))
fprintf('\nError between hardthresholding and hard = %f\n',norm(x1-x2))这里就不给出输出结果了。可以运行一下,从输出结果来看,函数的功能是正确的。
另外,可以在matlab里输入以下命令看一个软阈值的图像:
x=-5:0.01:5;T=1;y=hard(x,T);plot(x,y);grid;6、结束语
终于搞明白了硬阈值和软阈值,在文献【3】最后作者提到“哎,数学不好害死人啊,什么时候才能达到大牛们的高度啊”,相信很多人会有同样的感觉吧。但转念一想,我们不可能把矩阵分析、数值分析、泛函分析、最优化、组合数学等(脑子里就想到了这么多)所有的数学基础课内容都学完再去搞研究的,边研究边学习,哪儿不会了补哪儿才是最正常的模式吧……
再说了,如果让你单纯的学数学基础,你可能会感觉非常无聊,可能还会经常抱怨一句:学这些枯燥的数学有什么用呢?
还是继续前进吧,想信自己,路会越走越宽的……
7、参考文献
【1】Donoho D L, JohnstoneJ M. Ideal spatial adaptation by wavelet shrinkage[J]. Biometrika, 1994, 81(3):425-455.
【2】Wright SJ, Nowak R D, Figueiredo M A T. Sparse reconstruction by separableapproximation[J]. IEEE Transactions on Signal Processing, 2009, 57(7):2479-2493.
【3】http://blog.sina.com.cn/s/blog_6d0e97bb01015vq3.html
【4】Elad M,Figueiredo M A T, Ma Y. On the Role of Sparse and Redundant Representations inImage Processing[J]. Proceedings of the IEEE, 2010, 98(6):972-982.
【5】http://www.docin.com/p-553314466.html
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/131512.html原文链接:https://javaforall.cn
边栏推荐
- The Missing Semester
- 关于NAND FLASH解扣的认识
- Ansi/ul 94 VTM vertical burning test for thin materials
- 91. (cesium chapter) cesium rocket launch simulation
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5
- Fatal error: execution: there is no such file or directory
- [106] 360 check font - check whether the copyright of local Fonts is commercially available
- 顺序表有关操作
- Talk about the pessimistic strategy that triggers full GC?
- usb peripheral 驱动 - cable connect/disconnect
猜你喜欢
![[some notes]](/img/91/7657f90b50f012736579b1585b4ade.jpg)
[some notes]

Four years after graduation: work, resign, get married, buy a house

Sleep quality today 79 points

C summary of knowledge points 1

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

The Missing Semester

Leetcode force buckle (Sword finger offer 31-35) 31 Stack push pop-up sequence 32i II. 3. Print binary tree from top to bottom 33 Post order traversal sequence 34 of binary search tree The path with a

91.(cesium篇)cesium火箭發射模擬
![[106] 360 check font - check whether the copyright of local Fonts is commercially available](/img/a7/615e8000647b56f03a6a1d3dd81b6d.jpg)
[106] 360 check font - check whether the copyright of local Fonts is commercially available
![[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4](/img/4f/bc6c39ef4f2d1c4bdad8420f7badac.jpg)
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 4
随机推荐
【datawhale202206】pyTorch推荐系统:精排模型 DeepFM&DIN
Message queue monitoring refund task batch process
usb peripheral 驱动 - cable connect/disconnect
Talk about the pessimistic strategy that triggers full GC?
Talk about biological live broadcast - genovis Zhang Hongyan antibody specific enzyme digestion technology helps to characterize the structure of antibody drugs
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 5
栈的应用——括号匹配问题
91.(cesium篇)cesium火箭发射模拟
Common chart usage of Bi tools
编译调试Net6源码
【单片机】【数码管】数码管显示
Leetcode (Sword finger offer) - 58 - ii Rotate string left
AI matting tool
自组织是管理者和成员的双向奔赴
[Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 6
Efforts at the turn of the decade
The operation process of using sugar to make a large data visualization screen
Typora adds watermarks to automatically uploaded pictures
[JS] interview questions
被锡膏坑了一把