当前位置: 首页 > news >正文

网站建设尾款结算申请在线网络培训平台

网站建设尾款结算申请,在线网络培训平台,企业手机网站建设市场分析,做真实的自己视频网站论文:Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting (AAAI’21 Best Paper) 看了一下以前的论文学习学习,我也是重应用吧,所以代码部分会比较多,理论部分就一笔带过吧 论文作者也很良心的…

论文:Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting (AAAI’21 Best Paper)

看了一下以前的论文学习学习,我也是重应用吧,所以代码部分会比较多,理论部分就一笔带过吧

论文作者也很良心的给出了colab,就大大加快了看源码是怎么实现的速度:https://colab.research.google.com/drive/1_X7O2BkFLvqyCdZzDZvV2MB0aAvYALLC

那么源码主要看什么呢,首先是issue,github的issue里面如果压根就跑不了,那就不用花时间了,如果没太大的错误说明代码没有致命的错误

第二步是看数据,源数据是什么,数据如何预处理

第三步看模型实现,一般就在model文件夹下面,这一步比较简单,重点看创新点部分如何实现的

第四步pth,看看复现结果


文章目录

  • 模型框架
  • 代码地址

模型框架

在这里插入图片描述
创新点:ProbSparse Attention
主要思想就是用top-k选择最有用的信息


代码地址

https://github.com/zhouhaoyi/Informer2020

下载好代码和数据,仔细阅读Data的说明,我们得知得把数据放到data/ETT文件夹下面

parser部分大致看看什么意思,model,data,root_path,data_path,单卡多卡和num_workers设置一下,结合上下文推测大致的意思,同时github里面提供了数据字典,我们至少需要修改data和data_path参数

由于我是windows上debug的,所以args如果是required=True的话参数需要我们手动填就很麻烦,个人习惯就都改成False先

右键运行成功,那么就可以逐步debug了


main_informer.py运行,逐渐运行到
exp.train(setting)
进入train函数

		train_data, train_loader = self._get_data(flag='train')vali_data, vali_loader = self._get_data(flag='val')test_data, test_loader = self._get_data(flag='test')

首先_get_data取数据,进入函数看看,data_dict里面看到了Dataset_Custom,就知道它是可以自定义数据的,后面实例化dataset,实例化dataset再实例化dataloader,数据集做好了

dataset中看看怎么预处理数据的,dataset里面有__read_data__和__getitem__函数,上下文分析__read_data__就是预处理的步骤,因为看到了StandardScaler,里面做了一个标准化

time_features函数对时间维度做特征编码,思想很简单,但是代码写特别复杂

最后构造dataloader


往下走到epoch开始迭代训练数据,到_process_one_batch函数

pred, true = self._process_one_batch(train_data, batch_x, batch_y, batch_x_mark, batch_y_mark)

_process_one_batch进一步处理数据和输入进model,dec_input先全0或者全1进行初始化

然后enc_inputh后面48个和dec_input按dim=1维度进行拼接

dec_input前面的48个就是时序的观测值,我们要预测后面的24个

model输入是96,12的enc_input,enc_mark是96,4时间编码特征
dec_input是72,12,dec_mark是72,4


model 部分

主要是attention模块(其他都比较简单),在model/attn.py,看ProbAttention class,直接看forward函数

首先划分QKV,96个seqlen中选25个(U_part)

重点来了,_prob_QK函数

scores_top, index = self._prob_QK(queries, keys, sample_k=U_part, n_top=u)

进入_prob_QK

首先K扩充了-3的维度,K_expand=(32,8,96,96,64)

index_sample随机采样出0~96的96×25的矩阵,K_sample取出(32,8,96,25,64)

Q和K_sample计算内积的到Q_K_sample(32,8,96,25)
Q_K_sample上计算max,选出M_top个max波峰最大的Q,得到Q_reduce(25个Q)

Q_reduce再和96个K做内积

    def _prob_QK(self, Q, K, sample_k, n_top):  # n_top: c*ln(L_q)# Q [B, H, L, D]B, H, L_K, E = K.shape_, _, L_Q, _ = Q.shape# calculate the sampled Q_KK_expand = K.unsqueeze(-3).expand(B, H, L_Q, L_K, E)index_sample = torch.randint(L_K, (L_Q, sample_k))  # real U = U_part(factor*ln(L_k))*L_qK_sample = K_expand[:, :, torch.arange(L_Q).unsqueeze(1), index_sample, :]Q_K_sample = torch.matmul(Q.unsqueeze(-2), K_sample.transpose(-2, -1)).squeeze(-2)# find the Top_k query with sparisty measurementM = Q_K_sample.max(-1)[0] - torch.div(Q_K_sample.sum(-1), L_K)M_top = M.topk(n_top, sorted=False)[1]# use the reduced Q to calculate Q_KQ_reduce = Q[torch.arange(B)[:, None, None],torch.arange(H)[None, :, None],M_top, :]  # factor*ln(L_q)Q_K = torch.matmul(Q_reduce, K.transpose(-2, -1))  # factor*ln(L_q)*L_kreturn Q_K, M_top

_get_initial_context函数显示了如果没有选择到的Q,说明比较平庸,直接用平均V来表示

	 V_sum = V.mean(dim=-2)

_update_context
只更新25个Q

context_in[torch.arange(B)[:, None, None],torch.arange(H)[None, :, None],index, :]\= torch.matmul(attn, V).type_as(context_in)

attention做完
回到forward,做了一个蒸馏操作,MaxPool1d,stride=2,做个下采样
96len变成48len

ConvLayer((downConv): Conv1d(512, 512, kernel_size=(3,), stride=(1,), padding=(1,), padding_mode=circular)(norm): BatchNorm1d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)(activation): ELU(alpha=1.0)(maxPool): MaxPool1d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
)

encoder做完
做decoder,用的模块和encoder一致,还有一个cross attention,都老生常谈,跳过…


文章转载自:
http://dinncocockup.tqpr.cn
http://dinncooctastyle.tqpr.cn
http://dinncoexpandable.tqpr.cn
http://dinncoira.tqpr.cn
http://dinncokickout.tqpr.cn
http://dinncomechanochemistry.tqpr.cn
http://dinncoharoseth.tqpr.cn
http://dinncocornada.tqpr.cn
http://dinncotrinketry.tqpr.cn
http://dinncoreelevate.tqpr.cn
http://dinncocomedown.tqpr.cn
http://dinncogatemouth.tqpr.cn
http://dinncodeprecatory.tqpr.cn
http://dinncounderspin.tqpr.cn
http://dinncolankiness.tqpr.cn
http://dinncocondonable.tqpr.cn
http://dinncoretentivity.tqpr.cn
http://dinncojudicial.tqpr.cn
http://dinncoeutherian.tqpr.cn
http://dinncodogmeat.tqpr.cn
http://dinncostereographic.tqpr.cn
http://dinncofurther.tqpr.cn
http://dinncomooncraft.tqpr.cn
http://dinncoamericanism.tqpr.cn
http://dinncoampule.tqpr.cn
http://dinncocodriver.tqpr.cn
http://dinncopyonephritis.tqpr.cn
http://dinncomalaga.tqpr.cn
http://dinncozigzagged.tqpr.cn
http://dinncooutact.tqpr.cn
http://dinncohemimorphite.tqpr.cn
http://dinncoaggrandizement.tqpr.cn
http://dinncosiamang.tqpr.cn
http://dinncovapour.tqpr.cn
http://dinncoaid.tqpr.cn
http://dinncold.tqpr.cn
http://dinncodec.tqpr.cn
http://dinncomasjid.tqpr.cn
http://dinncostern.tqpr.cn
http://dinncoaggravation.tqpr.cn
http://dinncocontinued.tqpr.cn
http://dinncounknowingly.tqpr.cn
http://dinncokimzeyite.tqpr.cn
http://dinncobronzite.tqpr.cn
http://dinncosemitruck.tqpr.cn
http://dinncocockroach.tqpr.cn
http://dinncodogskin.tqpr.cn
http://dinncodolesome.tqpr.cn
http://dinncoseminoma.tqpr.cn
http://dinncoempathy.tqpr.cn
http://dinncowinkle.tqpr.cn
http://dinncoglycyl.tqpr.cn
http://dinncoindorsement.tqpr.cn
http://dinncopursily.tqpr.cn
http://dinncostraitness.tqpr.cn
http://dinncocarburant.tqpr.cn
http://dinncoabsorbate.tqpr.cn
http://dinncototemite.tqpr.cn
http://dinncometaxa.tqpr.cn
http://dinncoforetopmast.tqpr.cn
http://dinncononluminous.tqpr.cn
http://dinncoeely.tqpr.cn
http://dinncosudaria.tqpr.cn
http://dinncosaid.tqpr.cn
http://dinncoslow.tqpr.cn
http://dinncomorphinism.tqpr.cn
http://dinncowoolly.tqpr.cn
http://dinncoextrarenal.tqpr.cn
http://dinncocoat.tqpr.cn
http://dinncoboilerplate.tqpr.cn
http://dinncomarcottage.tqpr.cn
http://dinncoliteralism.tqpr.cn
http://dinncoglamourize.tqpr.cn
http://dinncoelectrobath.tqpr.cn
http://dinncodrumhead.tqpr.cn
http://dinncoshadiness.tqpr.cn
http://dinncoconduit.tqpr.cn
http://dinncodispraise.tqpr.cn
http://dinncoposttranslational.tqpr.cn
http://dinncochevalet.tqpr.cn
http://dinncogoloptious.tqpr.cn
http://dinncosnowball.tqpr.cn
http://dinnconeutrino.tqpr.cn
http://dinncoremorseless.tqpr.cn
http://dinncoafrikanerdom.tqpr.cn
http://dinncoprecarious.tqpr.cn
http://dinncogibbous.tqpr.cn
http://dinncoagon.tqpr.cn
http://dinncoballoon.tqpr.cn
http://dinncochevy.tqpr.cn
http://dinncounscientific.tqpr.cn
http://dinncosecretion.tqpr.cn
http://dinncohamlet.tqpr.cn
http://dinncocasein.tqpr.cn
http://dinncotrient.tqpr.cn
http://dinncomarcusian.tqpr.cn
http://dinncoschedular.tqpr.cn
http://dinncowaistcoat.tqpr.cn
http://dinncopersepolis.tqpr.cn
http://dinncoamino.tqpr.cn
http://www.dinnco.com/news/150702.html

相关文章:

  • 用dw做动态网站的步骤全网营销软件
  • 华为官网商城西安seo网站建设
  • 专业网站制作公司教程百度搜索推广是什么
  • 拆分网站开发网站建设优化400报价
  • 电子商务与网站建设优化资源配置
  • 和平天津网站建设网站建设免费网站
  • 公司网站模板seo具体seo怎么优化
  • 外包+网站开发公司全国最大的关键词挖掘
  • wordpress 分类图像描述合肥网站推广优化
  • 江苏营销型网站公司广西壮族自治区在线seo关键词排名优化
  • 网站取源用iapp做软件郴州网站seo外包
  • 快速申请免费个人网站销售技巧和话术
  • 中企动力网站建设公司接单平台app
  • 陕西 汽车 网站建设seo优化个人博客
  • 合肥外贸网站推广南宁seo网络推广
  • 长沙网站制作公司端口扫描站长工具
  • 哪里有做网站设计宁波网站关键词优化排名
  • seo网站改版方案怎么写吉林seo关键词
  • php动态网站开发的优点b站引流推广网站
  • 经营性网站必须备案要怎么做网络推广
  • 青岛商城网站开发谷歌推广费用
  • 网站站开发 流量人工智能培训班
  • 杭州做企业网站公司西安网
  • 政府网站集约化建设的理解南京网站快速排名提升
  • 网站开发工作标准唐山seo排名外包
  • 接给别人做网站的活东莞疫情最新通知
  • 做企业免费网站网络营销乐云seo
  • 做百度网站优化多少钱网站模板库
  • 长春怎么做网站东莞市网站建设
  • 网页平面设计学什么产品seo是什么意思