Code Monkey home page Code Monkey logo

dsai_hw1-electricity_forecasting's Introduction

DSAI-HW-2021

安裝

pip install -r requirements.txt

執行

python app.py --training training_data.csv --output submission.csv

使用資料

想法

  • 想要實作以下兩篇論文內容,應用在電力預測
  • 實際情況
    • 因為理解需要大量時間跟腦力,目前只做到使用 Alternating Optimization 做到用張量分解來「補值」,詳情參考下面「嘗試過程」,code 部分參考「test.ipynb」以及「MF.py」
    • 只有先用簡單的例子來測試
    • 對於完全沒有資訊的地方,傳統的矩陣分解會直接給出 trivial solution 也就是 0,所以不能拿來做預測(forcasting)
    • 要做預測需要加上時間相關的 Regularization term,參考 TRMF-AR(Temporal Regularized Matrix Factorization for High-dimensional Time Series Prediction)
    • 不過在實作的時候卡在一個點,來不及完成,所以這次的作業就先暫時用 Facebook 提供的 Prophet 模型完成,日後再來研究 TRMF 方法
    • 如果想要討論這部分(TRMF)的 code 或是論文,歡迎在 Github issue 留言

嘗試過程

  • CP 分解因為特徵矩陣均不稀疏,所以就只能用 dense matrix 了
  • 矩陣分解不穩定(就連 I 也都存在好幾種分解法)
    • 矩陣分解沒有唯一性
      • 不過可以看到 I 可以由 ATA 分解
      • 不過能不能至少我的 feature 是正交的?
        • 猜想:使用 SSD regularizer 會不會比較可以達到這點?
    • 不同初始值影響極大
    • 如果不是要求 SVD 那就可能不會轉換到那麼有特徵的空間了
    • Funk-SVD 不是 SVD,而是用近似的矩陣,是用來補缺失值的(也就是說原來非零的部分可以不用動)
  • 梯度下降非常容易收斂不了
    • 因為是 non-convex
    • 加上 regularization term
      • penalty_weight 太高(1)效果不太好,但是小於 1e-2 效果不錯
        • 但好像原本的(penalty_weight=0)比較好
        • 在 I3x3 之下,1e-3
          • 1e-4 以下沒作用
          • 1 附近訓練最久,效果又是偏向 regularization term(四不像)
          • 大於 1000 會 overflow
      • 加了之後收斂會變慢,但是比較不會被困住
    • rank = min(X.shape) 要記得加在,不然就會是 low rank 的結果
    • 補值的效果不好
      • 因為忘記加遮罩(mask),加完後效果不錯
      • ALS 加上遮罩之後要用加總有觀察到的東西來算
    • 對於完全沒有資訊的地方,ALS 會直接給出 trivial solution 也就是 0,後面的東西也都會被洗掉
    • ALS 比 SGD 稍慢!?
      • 但迭代次數可以少十倍以上
  • ALS
  • GRALS
    • Graph Regularized Alternating Least Squares
    • 可以有不需要 vectorization 的計算方法
  • TRMF
    • 有點卡住,不太知道如何 Updating X,要如何和 GRALS 完全對應

參考資料

dsai_hw1-electricity_forecasting's People

Contributors

timcsy 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.