【发布时间】:2021-04-12 02:54:02
【问题描述】:
我正在使用TF.CsvDataset 从磁盘加载数据。并将数据绘制为
#This is the transformation function applied on loaded data before displaying histogram.
def preprocess(*fields):
print(len(fields))
features=tf.stack(fields[:-1])
labels=tf.stack([int(x) for x in fields[-1:]])
return features,labels # x, y
for features,label in train_ds.take(1000):
# print(features[0])
plt.hist(features.numpy().flatten(), bins = 101)
我得到了这个直方图
但我想根据二进制类标签绘制 712 个特征值的分布。即class label为0时,feature 1,2 or 3的取值是多少。
如何用 pyplot 做到这一点?
我已阅读以下主题,但没有任何帮助。
【问题讨论】:
-
嗨@NicolasGervais 感谢您提供这些链接,但我可以获得标签。我只是要求用类标签分类来绘制我的数据。
-
我更新了问题以便澄清
标签: python tensorflow matplotlib machine-learning histogram