光谱熵大于1

时间:2018-04-22 17:17:49

标签: python numpy scipy entropy

我试图按如下方式计算数组的谱熵:

>>> def ent(data):
...     uniqw, inverse = np.unique(data, return_inverse=True)
...     p_data= np.bincount(inverse)/len(data) # calculates the probabilities
...     ent=entropy(p_data)  # input probabilities to get the entropy
...     return ent

How do I measure request and response times at once using cURL? ,我派生了我的代码。但是,我发现我的数据是浮动的,所以我也调整了this的代码来制定以下内容:

>>> ent(freqArray)
1.791759469228055

结果是

import json
import re
import requests

url = 'https://www.energystorageexchange.org/projects/6'

r = requests.get(url)
html = r.text

markers_raw = re.search(
    r'Gmaps\.map\.markers'
    r'\s*=\s*'
    r'(.*);', html).group(1)

markers = json.loads(markers_raw)

import pprint
pprint.pprint(markers)

如何让我的熵介于0和1之间

0 个答案:

没有答案