如何去掉剧情中的图例seaborn.JoingGrid?
参考代码如下:
import matplotlib.pyplot as plt
import seaborn as sns
penguins = sns.load_dataset("penguins")
g = sns.JointGrid(data=penguins, x="bill_length_mm", y="bill_depth_mm", hue="species")
g.plot_joint(sns.scatterplot)
sns.boxplot(data=penguins, x=g.hue, y=g.y, ax=g.ax_marg_y)
sns.boxplot(data=penguins, y=g.hue, x=g.x, ax=g.ax_marg_x)
plt.show()
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下已知适用于其他seaborn地块的方法,但在jointplot上失败了:
plt.legend([],[], frameon=False)
g._legend.remove()
Run Code Online (Sandbox Code Playgroud) 我有一个问题,如何从 pytorch 数据加载器获取批量迭代的总数?
以下是训练的常用代码
for i, batch in enumerate(dataloader):
Run Code Online (Sandbox Code Playgroud)
那么,有没有什么方法可以获取“for循环”的总迭代次数?
在我的 NLP 问题中,总迭代次数不同于 int(n_train_samples/batch_size)...
例如,如果我只截断训练数据 10,000 个样本并将批大小设置为 1024,那么在我的 NLP 问题中会发生 363 次迭代。
我想知道如何获得“for 循环”中的总迭代次数。
谢谢你。
如何缩放seaborn联合图的边际kdeplot?
假设我们有 1000 个类型“a”的数据、100 个类型“b”的数据和“100”个类型“c”的数据。
在这种情况下,边际 kdeplot 的尺度看起来并不相同,因为分类数据的大小完全不同。
我如何使这些相同?
我制作了一个玩具脚本,如下所示:
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
ax, ay = 1 * np.random.randn(1000) + 2, 1 * np.random.randn(1000) + 2
bx, by = 1 * np.random.randn(100) + 3, 1 * np.random.randn(100) + 3
cx, cy = 1 * np.random.randn(100) + 4, 1 * np.random.randn(100) + 4
a = [{'x': x, 'y': y, 'kind': 'a'} for x, y in zip(ax, ay)]
b …Run Code Online (Sandbox Code Playgroud) jointplot ×2
seaborn ×2
dataloader ×1
for-loop ×1
jointgrid ×1
legend ×1
matplotlib ×1
python ×1
pytorch ×1
scaling ×1