小编rcs*_*hon的帖子

为什么我在 matplotlib 中的图没有显示轴

我在处理绘图时遇到了问题,因为在我处理它时,轴标签似乎显示在 Jupyter Notebooks 中。

但是,当我将文件导出到 .py 文件并在终端中运行它时,给出的图表没有轴标签。

fig = plt.figure(figsize = (15,5))

ax = fig.add_axes([0,0,1,1])
ax.set_title('Oil vs Banks Mean Return')
ax.set_xlabel('Date')
ax.set_ylabel('Price')

ax.plot(all_returns['Mean'], label = 'Banks Mean', color = 'green')
ax.plot(all_returns['Oil'], label = 'Oil', color = 'black')
ax.plot(movavg['Mean'], label = 'Mean MA', color = 'blue')
ax.plot(movavg['Oil'], label = 'OIL MA', color = 'red')

ax.legend()

plt.tight_layout();
Run Code Online (Sandbox Code Playgroud)

在 Jupyter Notebooks 中,它显示轴和标签,例如。年份等: 在 Jupyter Notebooks 中,它显示轴和标签,例如。 年等

但是,当我导出它时,它们不见了: 但是,当我导出它时,它们消失了

python matplotlib pandas

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

是否可以仅冻结pytorch嵌入层中的某些嵌入权重?

在NLP任务中使用GloVe嵌入时,GloVe中可能不存在来自数据集的某些单词。因此,我们为这些未知单词实例化随机权重。

是否可以冻结从GloVe获得的重量,并仅训练新实例化的重量?

我只知道我们可以设置:model.embedding.weight.requires_grad = False

但这使新单词难以训练。

还是有更好的方法来提取单词的语义。

python nlp word-embedding pytorch glove

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

标签 统计

python ×2

glove ×1

matplotlib ×1

nlp ×1

pandas ×1

pytorch ×1

word-embedding ×1