当前位置:网站首页>Pytorch lstm time series prediction problem stepping on the pit "recommended collection"
Pytorch lstm time series prediction problem stepping on the pit "recommended collection"
2022-07-31 20:01:00 【Full stack programmer webmaster】
大家好,又见面了,我是你们的朋友全栈君.
这里写目录标题
1.做时间序列问题
2.问题
1.数据集自己做,为多个输入对应多个或一个输出
2.损失函数
注意:不能用交叉熵 nn.CrossEntropyLoss()
nn.CrossEntropyLoss()要求target目标值即真实值是标签,是torch.int64类型数据,即整数,不允许小数,如果输入小数会强行取整, 应该用
nn.MSELoss()我在这个问题上纠结了很久,总是显示
RuntimeError: expected scalar type Long but found Float导致我找了很久怎么样才能把torch.float64保留小数的情况下转成long,后来查资料torch.long就是torch.int64,简直变态 后来一点一点往上找才知道的这个错误
注意2:真实值(目标值)必须是两个维度,否则会警告,不会报错
增加维度方法:
1.torch.unsqueeze(tensor, dim)
2.numpy_array = .numpy_array [np.newaxis, :, :] # 原来维度(10, 13)——(1, 10, 13)
补充
np.unaqueeze总是报错,不明白为什么3.准确率
分类问题是有准确率这个评价的,但是我训练的rnn,loss一直降低,但是准确率为0,才反应过来,回归问题很难达到完全一致
3.结果
这是测试集预测结果,前10步预测后1步,勉强可以
训练集结果:
之后需要 0.5. 根据上一步预测结果预测下一个——做不到,x为13个变量,y只有1个,无法用y作为下一个x
- 找一个预测结果评价指标
- transformer编码解码
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/127416.html原文链接:https://javaforall.cn
边栏推荐
- MySQL---运算符
- [Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement
- rj45 to the connector Gigabit (Fast Ethernet interface definition)
- 返回一个零长度的数组或者空的集合,不要返回null
- multithreaded lock
- 抖音根据关键词取视频列表 API
- BM3 将链表中的节点每k个一组翻转
- MySQL---多表查询
- Shell 脚本 快速入门到实战 -02
- Cache and Database Consistency Solutions
猜你喜欢

广汽本田安全体验营:“危险”是最好的老师

Redis Overview: Talk to the interviewer all night long about Redis caching, persistence, elimination mechanism, sentinel, and the underlying principles of clusters!...

Socket回顾与I/0模型

The whole network is on the verge of triggering, and the all-round assistant for content distribution from media people - Rongmeibao

leetcode:6135. 图中的最长环【内向基环树 + 最长环板子 + 时间戳】

角色妆容的实现

MySQL---子查询

老牌音乐播放器 WinAmp 发布 5.9 RC1 版:迁移到 VS 2019 完全重建,兼容 Win11

AI 自动写代码插件 Copilot(副驾驶员)

全平台GPU通用AI视频补帧超分教程
随机推荐
rj45 to the connector Gigabit (Fast Ethernet interface definition)
leetcode:6135. 图中的最长环【内向基环树 + 最长环板子 + 时间戳】
【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
有一说一,外包公司到底值不值得去?
Bika LIMS open source LIMS set - use of SENAITE (detection process)
The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
MySQL---operator
多线程之锁
MySQL---创建和管理数据库和数据表
SiC MOSFET的短路特性及保护
grep command written test questions
Embedded development has no passion, is it normal?
API for JD.com to obtain historical price information of commodities
MySQL---Create and manage databases and data tables
Financial profitability and solvency indicators
multithreaded lock
<artifactId>ojdbc8</artifactId>「建议收藏」
Basics of ResNet: Principles of Residual Blocks
AI 自动写代码插件 Copilot(副驾驶员)
性能优化:记一次树的搜索接口优化思路