模糊熵理论相关知识与代码实现

关于本博客的说明: 本次博客主要分享模糊熵(Fuzzy Entropy, FuzzyEn, FE)的理论相关知识及其代码实现. 

之前分享过有关近似熵样本熵的博客,有兴趣的博友欢迎前往观看,不足之处还请不吝赐教!https://blog.csdn.net/cratial/article/details/79707169(近似熵)

https://blog.csdn.net/cratial/article/details/79742363(样本熵)

一、理论基础

与近似熵(ApEn)和样本熵(SampEn)的物理意义相似,模糊熵(FuzzyEn)衡量的也是新模式产生的概率大小,测度值越大,新模式产生的概率越大,即序列复杂度越大。

算法描述如下:

通常情况下,较大的m能更细致地重构系统的动态演化过程。相似容限r的取值也是一个值得考虑的问题,过大的相似容限会导致信息丢失,相似容限值越大,丢失的信息越多,而太小的相似容限度则会增加结果对噪声的敏感性,一般定义r为r*SD,其中SD(Standard Deviation)为原一维时间序列的标准差[1,2]。

二、代码实现

matlab

function fuzzyen = Fuzzy_Entropy( dim, r, data, tau )
% FUZZYEN Fuzzy Entropy
%   calculates the fuzzy entropy of a given time series data

% Similarity definition based on vectors' shapes, together with the
% exclusion of self-matches, earns FuzzyEn stronger relative consistency
% and less dependence on data length.

%   dim     : embedded dimension 
%   r       : tolerance (typically 0.2 * std)
%   data    : time-series data
%   tau     : delay time for downsampling (user can omit this, in which case
%             the default value is 1)
%

if nargin < 4, tau = 1; end
if tau > 1, data = downsample(data, tau); end

N = length(data);
Phi = zeros(1,2);

for m = dim:dim+1
    
    Ci = zeros(1,N-m+1);
    dataMat = zeros(m,N-m+1);
    
    % setting up data matrix - form vectors
    for j = 1:m
        dataMat(j,:) = data(j:N-m+j);
    end
    
    % baseline
    U0 = mean(dataMat);
    % remove baseline and calculate the absolute values
    Sm = abs(dataMat - repmat(U0,m,1));
    
    % Given vector Si, calculate the similarity degree between its'
    % neighboring vector Sj
    for i = 1:N-m+1
        
        Sm_tmp = Sm;
        Sm_tmp(:,i) = []; % excluded self-matches
        % maximum absolute difference of the corresponding scalar components
        % of Si and Sj (j≠i)
        dij = max(repmat(Sm(:,i),1,N-m) - Sm_tmp);
        % similarity degree
        Aij = exp(-log(2)*(dij/r).^2);
        % averaging all the similarity degree of its neighboring vectors Sj
        Ci(i) = sum(Aij)/(N - m);
        
    end
    
    % summing over the counts
    Phi(m-dim+1) = sum(Ci)/(N-m+1); % φ_m and φ_m+1
    
end

fuzzyen = log(Phi(1))-log(Phi(2));  % fuzzyen = ln(φ_m)-ln(φ_m+1)

end

参考文献:

[1]. Chen W, Zhuang J, Yu W, et al. Measuring complexity using fuzzyen, apen, and sampen[J]. Medical Engineering and Physics, 2009, 31(1): 61-68.

[2]. 孙克辉, 贺少波, 尹林子,等. 模糊熵算法在混沌序列复杂度分析中的应用[J]. 物理学报, 2012, 61(13):71-77.

  • 32
    点赞
  • 196
    收藏
    觉得还不错? 一键收藏
  • 28
    评论
评论 28
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值