Giter Club home page Giter Club logo

sample_attention_lstm's Introduction

Sample_Attention_LSTM

源于一次对于Self-attention的错误理解,产生了使用样本之间的相似度来提供参考值的做法

模型结构很简单,就是使用测试样本作为样本池,用当前样本和样本池中的样本做一个Attention,得到的参考值拼接到原有的特征维度上,然后导入LSTM层里

效果很不错,拟合效果和预测效果都可以

数据使用的某城市某区的非公开的电力数据集,这里不会上传,相关的数据也会做隐藏。数据量本身很小,总共68个时间点。做过时序预测的都会苦恼这个数据量的问题,但这个模型对数据量小的数据集还是挺友好的。

数据里本身包含几千户的用电曲线,这些用户大多数都是大工业用户和商业用户,用电量与季节的相关性不强。为了解决这个问题,我先对这些用户进行聚类,聚类后对其中一类进行了整体预测。

聚类

聚类的轮廓系数图: image

聚类的簇内误方差: image、 所以最终选择聚3类

数据曲线

image

拟合曲线

image

测试集效果

image

误差统计

image

可以看到,效果还是很不错的,就是有一个异常点误差比较大34%。经过历史数据的查询,发现该时间点对应的是2022年4月,正好是疫情影响最严重的时间,与2021年相比,下挫了25%。如果按照正常规律发展,应该比往年略微有所上升。因此,如果不考虑疫情的影响,该点误差应该会落在10%以内。总误差2.67%

sample_attention_lstm's People

Contributors

dlspllf avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.