当前位置:网站首页>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 入门之旅
- grep command written test questions
- 【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
- Taobao/Tmall get Taobao password real url API
- 【AcWing】The 62nd Weekly Match 【2022.07.30】
- INeuOS industrial Internet operating system, the equipment operational business and "low code" form development tools
- renderjs usage in uni-app
- Chinese encoding Settings and action methods return values
- What is Thymeleaf?How to use.
- <artifactId>ojdbc8</artifactId>「建议收藏」
猜你喜欢
35 MySQL interview questions and diagrams, this is also easy to understand
基于STM32 环形队列来实现串口接收数据
The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
Socket Review and I/0 Model
leetcode: 6135. The longest ring in the graph [inward base ring tree + longest ring board + timestamp]
Poker Game in C# -- Introduction and Code Implementation of Blackjack Rules
MySQL---多表查询
第六章
架构实战营模块八作业
NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
随机推荐
Apache EventMesh 分布式事件驱动多运行时
Chinese encoding Settings and action methods return values
Unity 之 音频类型和编码格式介绍
idea中搜索具体的字符内容的快捷方式
PCB叠层设计
返回一个零长度的数组或者空的集合,不要返回null
MySQL---聚合函数
性能优化:记一次树的搜索接口优化思路
【愚公系列】2022年07月 Go教学课程 025-递归函数
AI 自动写代码插件 Copilot(副驾驶员)
Basics of ResNet: Principles of Residual Blocks
BM5 合并k个已排序的链表
35 MySQL interview questions and diagrams, this is also easy to understand
【Yugong Series】July 2022 Go Teaching Course 023-List of Go Containers
rj45 to the connector Gigabit (Fast Ethernet interface definition)
MySQL---Create and manage databases and data tables
MySQL---排序与分页
matplotlib ax bar color 设置ax bar的颜色、 透明度、label legend
【论文精读】iNeRF
leetcode 665. Non-decreasing Array 非递减数列(中等)