当前位置:网站首页>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
边栏推荐
- sqlite3简单操作
- 顺序表的实现
- 财务盈利、偿债能力指标
- MySQL - multi-table query
- 请问我的这段sql中sql语法哪里出了错
- matplotlib ax bar color Set the color, transparency, label legend of the ax bar
- 有一说一,外包公司到底值不值得去?
- [PIMF] OpenHarmony Thesis Club - Inventory of the open source Hongmeng tripartite library [3]
- NVIDIA已经开始测试AD106和AD107 GPU核心的显卡产品
- Thymeleaf是什么?该如何使用。
猜你喜欢
第六章
中文编码的设置与action方法的返回值
leetcode:6135. 图中的最长环【内向基环树 + 最长环板子 + 时间戳】
35道MySQL面试必问题图解,这样也太好理解了吧
使用 Flutter 和 Firebase 制作!计数器应用程序
How can we improve the real yourself, become an excellent architect?
基于STM32 环形队列来实现串口接收数据
学生管理系统第一天:完成登录退出操作逻辑 PyQt5 + MySQL5.8
Three. Introduction to js
Embedded development has no passion, is it normal?
随机推荐
MySQL---Subqueries
有一说一,外包公司到底值不值得去?
统计UTF-8字符串中的字符函数
全平台GPU通用AI视频补帧超分教程
idea中搜索具体的字符内容的快捷方式
MySQL---基本的select语句
【PIMF】OpenHarmony 啃论文俱乐部—盘点开源鸿蒙三方库【3】
MySQL---aggregate function
"The core concept of" image classification and target detection in the positive and negative samples and understanding architecture
leetcode 665. Non-decreasing Array
Three. Introduction to js
Bika LIMS open source LIMS set - use of SENAITE (detection process)
抖音根据关键词取视频列表 API
PCB叠层设计
Chinese encoding Settings and action methods return values
The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
MySQL---创建和管理数据库和数据表
Socket Review and I/0 Model
Tkinter 入门之旅
linux查看redis版本命令(linux查看mysql版本号)