当前位置:网站首页>硬阈值(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
边栏推荐
- Golang des-cbc
- Sum of factor numbers of interval product -- prefix sum idea + fixed one shift two
- Friends day 2022
- 【datawhale202206】pyTorch推荐系统:多任务学习 ESMM&MMOE
- 【datawhale202206】pyTorch推荐系统:精排模型 DeepFM&DIN
- C serialization simple experiment
- Relationship between accuracy factor (DOP) and covariance in GPS data (reference link)
- [Yunju entrepreneurial foundation notes] Chapter 7 Entrepreneurial Resource test 2
- MySQL data table creation
- (mixed version 1) multiple TXT text to one table
猜你喜欢

uniapp 使用 uni-upgrade-center

Computer graduation project asp Net hotel room management system VS development SQLSERVER database web structure c programming computer web page source code project

消息队列之监控退款任务批处理过程

Joint Time-Frequency and Time Domain Learning for Speech Enhancement

Common chart usage of Bi tools

【20211129】Jupyter Notebook远程服务器配置

Use of easyexcel

BIM and safety in road maintenance-buildSmart Spain

MySQL workbench data modeling function

I wish you all a happy reunion
随机推荐
顺序表有关操作
[Yu Yue education] financial management reference materials of Ningbo University of Finance and Economics
fatal error: execution: 没有那个文件或目录
AI抠图工具
编译调试Net6源码
(混更一篇)多个txt文本转一个表格
Rural guys earn from more than 2000 a month to hundreds of thousands a year. Most brick movers can walk my way ǃ
Use set_ Handler filters out specific SystemC wrapping & error messages
ASTM D 3801 vertical burning test of solid plastics
Golang introduces the implementation method of the corresponding configuration file according to the parameters
IOS interview
One year anniversary of bitbear live studio, hero rally order! I invite you to take a group photo!
Blue Bridge Cup multi interface switching processing (enumeration plus state machine method)
【20220605】文献翻译——虚拟现实中的可视化:一个系统的回顾
The Missing Semester
ASP.NET Core 6 从入门到企业级实战开发应用技术汇总
Compile and debug net6 source code
leetcode 406. Queue reconstruction by height
Summary of JFrame knowledge points 1
Ansible的playbook