我在绘制散点图时遇到了问题
我想要在散点图上绘制音频特征的值,以获得清晰的视觉效果(因为我在训练集中有5个音频文件-在增加数据集后,我将使用它们来训练KNN/SVM等)
标记的training_labels为[0, 0, 1, 2, 1]
而training_feature值是
[
[103.359375, [11, 36, 60, 85, 110, 134, 159, 183, 208, 232, 257, 286, 310, 335]],
[89.10290948275862, [11, 41, 69, 98, 127, 155, 184, 213, 241, 270, 299, 327, 356]],
[151.99908088235293, [7, 24, 41, 57, 73, 90, 107, 123, 140, 157, 173, 189, 206, 223, 239, 256, 272, 290, 307, 325, 343, 360, 377]],
[143.5546875, [39, 57, 77, 95, 114, 132, 150, 168, 186, 204, 222, 239, 256, 272, 288, 305, 322, 340]],
[83.35433467741936, [8, 38, 70, 101, 137, 168, 199, 230, 266, 298, 334, 365]]
]
每个要分类的对象都有两个称为tempo
和beat per minute
的特征
如何在散点图中绘制此图?
我尝试了以下方法,但由于x和y的大小不同而失败
featureA = [x[0] for x in training_features]
featureB = [x[1] for x in training_features]
plt.scatter(featureA[:2], featureB[:2])
plt.scatter(featureA[2:], featureB[2:], color='r')
plt.xlabel('Beat Frame')
plt.ylabel('Tempo')
这会给我一个错误的ValueError: setting an array element with a sequence.
。请帮助:)
编辑:还有一件事,我如何绘制多个特征,即(>2),我想使用光谱质心,过零率,mfcc等,然后绘制结果
https://stackoverflow.com/questions/41370734
复制相似问题