当前位置:网站首页>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
边栏推荐
- 【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
- 京东按关键字搜索商品 API
- Short-circuit characteristics and protection of SiC MOSFETs
- 【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
- 【AcWing】The 62nd Weekly Match 【2022.07.30】
- sqlite3 simple operation
- sqlite3简单操作
- iNeuOS工业互联网操作系统,设备运维业务和“低代码”表单开发工具
- 老牌音乐播放器 WinAmp 发布 5.9 RC1 版:迁移到 VS 2019 完全重建,兼容 Win11
- 手把手教你学会部署Nestjs项目
猜你喜欢
随机推荐
Shell script quick start to actual combat -02
What's wrong with the sql syntax in my sql
统计UTF-8字符串中的字符函数
Given an ip address, how does the subnet mask calculate the network number (how to get the ip address and subnet mask)
BM3 将链表中的节点每k个一组翻转
JD.com searches for products by keyword API
【Yugong Series】July 2022 Go Teaching Course 025-Recursive Function
How can we improve the real yourself, become an excellent architect?
请问我的这段sql中sql语法哪里出了错
SiC MOSFET的短路特性及保护
淘宝/天猫获得淘口令真实url API
How to change npm to Taobao mirror [easy to understand]
linux查看redis版本命令(linux查看mysql版本号)
Architect 04 - Application Service Encryption Design and Practice
Made with Flutter and Firebase!counter application
Apache EventMesh 分布式事件驱动多运行时
API for JD.com to obtain historical price information of commodities
广汽本田安全体验营:“危险”是最好的老师
【PIMF】OpenHarmony 啃论文俱乐部—盘点开源鸿蒙三方库【3】
全平台GPU通用AI视频补帧超分教程









