小编San*_*eep的帖子

如何使用python将对数概率转换为0到1之间的简单概率

我正在使用高斯混合模型进行说话人识别。我使用此代码来预测每个语音剪辑的说话者。

for path in file_paths:   
path = path.strip()   
print (path)
sr,audio = read(source + path)
vector   = extract_features(audio,sr)
#print(vector)
log_likelihood = np.zeros(len(models))
#print(len(log_likelihood))
for i in range(len(models)):
    gmm1   = models[i]  #checking with each model one by one
    #print(gmm1)
    scores = np.array(gmm1.score(vector)) 
    #print(scores)
    #print(len(scores))
    log_likelihood[i] = scores.sum()
    print(log_likelihood)
    winner = np.argmax(log_likelihood)
    #print(winner)
print ("\tdetected as - ", speakers[winner])
Run Code Online (Sandbox Code Playgroud)

它给了我这样的输出:

[ 311.79769716    0.            0.            0.            0.        ]
[  311.79769716 -5692.56559902     0.             0.             0.        ]
[  311.79769716 -5692.56559902 -6170.21460788     0.             0.        ]
[ …
Run Code Online (Sandbox Code Playgroud)

python speech-recognition gaussian voice-recognition gmm

5
推荐指数
1
解决办法
3668
查看次数

如何从饼图中删除 0%

我正在使用文本数据来查找情绪分析。我有每个句子的情感得分数据框。使用这些数据我正在创建一个饼图,但它在图中显示了 0%。我无法理解这个 0% 的含义。这是我的数据框 df1:

            score
Negative    100.0
Neutral     0.0
Positive    0.0
Run Code Online (Sandbox Code Playgroud)

这是我创建饼图的代码:

import matplotlib.pyplot as plt
import os
plt.figure(figsize=(4,3))
df1.plot(kind='pie', autopct='%1.1f%%', subplots=True,startangle=90,  legend = False, fontsize=14)
plt.axis('off')
plt.show()
Run Code Online (Sandbox Code Playgroud)

这是我的输出图:

我怎样才能从我的情节中删除这个 0%?

在此处输入图片说明

python matplotlib pandas pie-chart

3
推荐指数
1
解决办法
3696
查看次数

如何从pandas数据框中查找最近24小时的数据

我有一个数据,其中有两列,一列是描述,另一列是发布位置。我在publishedAt列上应用了排序函数并获得了日期降序排列的输出。这是我的数据框的示例:

\n\n
        description publishedAt\n13  Bitcoin price has failed to secure momentum in...   2018-05-06T15:22:22Z\n16  Brian Kelly, a long-time contributor to CNBC\xe2\x80\x99s...   2018-05-05T15:56:48Z\n2   The bitcoin price is less than $100 away from ...   2018-05-05T13:14:45Z\n12  Mati Greenspan, a senior analyst at eToro and ...   2018-05-04T16:05:37Z\n52  A Singaporean startup developing \xe2\x80\x98smart bankno...   2018-05-04T14:02:30Z\n75  Cryptocurrencies are set to make a comeback on...   2018-05-03T08:10:19Z\n76  The bitcoin price is hovering near its best le...   2018-04-30T16:26:57Z\n74  In today\xe2\x80\x99s climate of ICOs with 100 billion to...   2018-04-30T12:03:31Z\n27  Investment guru …
Run Code Online (Sandbox Code Playgroud)

python datetime

2
推荐指数
1
解决办法
4869
查看次数