当前位置:网站首页>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
边栏推荐
- Tkinter 入门之旅
- MySQL---Subqueries
- 第六章
- Embedded development has no passion, is it normal?
- 架构实战营模块八作业
- 1161. Maximum Sum of Elements in Layer: Hierarchical Traversal Application Problems
- 中文编码的设置与action方法的返回值
- API for JD.com to obtain historical price information of commodities
- leetcode 665. Non-decreasing Array
- 多线程之锁
猜你喜欢
第七章
顺序表的实现
架构实战营模块 8 作业
老牌音乐播放器 WinAmp 发布 5.9 RC1 版:迁移到 VS 2019 完全重建,兼容 Win11
使用 Flutter 和 Firebase 制作!计数器应用程序
Poker Game in C# -- Introduction and Code Implementation of Blackjack Rules
Embedded development has no passion, is it normal?
Memblaze released the first enterprise-grade SSD based on long-lasting particles. What is the new value behind it?
嵌入式开发没有激情了,正常吗?
Introduction to Audio Types and Encoding Formats in Unity
随机推荐
Bika LIMS 开源LIMS集—— SENAITE的使用(检测流程)
find prime numbers up to n
leetcode 665. Non-decreasing Array
微信小程序的路由拦截
MySQL---聚合函数
uni-app中的renderjs使用
Cache and Database Consistency Solutions
NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
【愚公系列】2022年07月 Go教学课程 025-递归函数
Embedded development has no passion, is it normal?
高效并发:Synchornized的锁优化详解
grep命令 笔试题
grep command written test questions
Made with Flutter and Firebase!counter application
MySQL---Basic select statement
How can we improve the real yourself, become an excellent architect?
关注!海泰方圆加入《个人信息保护自律公约》
Mobile web development 02
Financial profitability and solvency indicators
角色妆容的实现