python 样本熵介绍

前言

本文对样本熵 python 代码进行简单分析,获取每个分量数据的样本熵

Code

官方介绍

def SampEn():
    #读取数据集
    for i in range(5):
        dataframe_imf = read_csv(f'./vmd/IMF_{i+1}.csv', usecols=[0], engine='python',encoding="gbk")
        dataset_imf = dataframe_imf.values
        sampen_imf = sampen2(dataset_imf)
        print(f'sampen_imf{i+1}: {sampen_imf}')

if __name__ == '__main__':
    SampEn()
  

默认最大历元长度(m)为2,默认公差(r)为0.2。

结果展示:

sampen_imf1: [(0, 3.2635538318031165, 0.0004441663077339741), (1, 0.3468382561052286, 0.010319715837309756), (2, 0.353191369967474, 0.014143863700708897)]
sampen_imf2: [(0, 3.3066724054774577, 0.00031384008713812106), (1, 1.9570282466054054, 0.0022204674099864387), (2, 0.6711171533904225, 0.004319649830470162)]
sampen_imf3: [(0, 2.3697360006541452, 0.0008725374548332297), (1, 1.6524762081718944, 0.0033783969797985722), (2, 0.6049883101373816, 0.0036742795970025216)]
sampen_imf4: [(0, 1.6242143460812242, 0.002094686493762676), (1, 1.5380410099853907, 0.0058497524076661245), (2, 0.24741057032919023, 0.008952342738268795)]
sampen_imf5: [(0, 1.5022984771919419, 0.002199952517868058), (1, 0.9995665719478257, 0.007075134006352749), (2, 0.48139083559347773, 0.007289865570226699)]
# Epoch length for max epoch(最大长度),  SampEn(样本熵的值), Standard Deviation(标准偏差)

总结

样本熵具有两个优势:

  • 样本熵的计算不依赖数据长度;
  • 样本熵具有更好的一致性,即参数m和r的变化对样本熵的影响程度是相同的。

你可能感兴趣的:(Python基础学习,时间序列预测,python,机器学习,人工智能)