idaaa
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    [...]DeepFM === > [name=ida][time=20220820] > - 再來呢,第一篇文中提到稀疏矩陣的救星,就天真的以為它真的可以來救救我,沒想到⋯⋯ > - 因為呢,瀏覽器分頁開太多,這樣會形成前進的阻止,拖累我們向前走的速度,被困在分頁海裡面,前進不了 > - 雖然現在 chrome 已經可以把分頁分組了,但還是覺得很累,資訊量太大了消化不良,所以打算把它們全都關關掉! > - 但直接關掉嗎?又覺得不太對,把重點節錄好了,這樣比較不會那麼良心不安(你是有良心逆齁?) > - 我們看那麼多科普的 model based, memory based 推薦法,但在看 DeepFM 又好像來到另一個平行世界,到底發生什麼事? [toc] --- ### [在 FM 之前,要先理解 MF] #### MF(矩陣分解) 轉 FM! 《推荐系统学习笔记-4 FM,FFM,Wide & Deep,DeepFM》 [[src-知乎]](https://zhuanlan.zhihu.com/p/268776484) - 雖然裡面羅列了 FM、FFM、Wide、Deep、DeepFM - 但我現下最想記下來的還是 MF(咦? - MF(Matrix Factorization,矩陣分解)模型是個在推薦系統領域裡資格很深的老前輩協同過濾模型了。核心思想是通過兩個低維小矩陣(一個代表用戶embedding矩陣,一個代表物品embedding矩陣)的乘積計算,來模擬真實用戶點擊或評分產生的大的協同信息稀疏矩陣,本質上是編碼了用戶和物品協同信息的降維模型。 - MF最基礎的分解方式,將評分矩陣R分解為用戶矩陣U和項目矩陣S, 通過不斷的迭代訓練使得U和S的乘積越來越接近真實矩陣,矩陣分解過程如圖: - ![](https://i.imgur.com/ErhCeT6.png =300x) - ![](https://i.imgur.com/zjfcTI6.png =300x)(src = https://blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/88265583) - 預測值接近真實值就是使其差最小,這是我們的目標函數,然後採用梯度下降的方式迭代計算U和S,它們收斂時就是分解出來的矩陣。我們用損失函數來表示誤差(等價於目標函數): - ![](https://i.imgur.com/QIObYOJ.png =300x) - R_ij是評分矩陣中已打分的值,U_i和S_j相當於未知變量。為求得最小值,相當於求關於U和S二元函數的最小值(極小值或許更貼切)。通常採用梯度下降的方法: - ![](https://i.imgur.com/inp3xPj.png =300x) - MF到FM的轉化 - ![](https://i.imgur.com/tSqWhH9.png =300x) - 本質上,MF模型是FM模型的特例,MF可以被認為是只有User ID 和Item ID這兩個特徵Fields的FM模型,MF將這兩類特徵通過矩陣分解,來達到將這兩類特徵embedding化表達的目的。通過梯度下降法來計算向量內積和實際評分矩陣之間的損失函數不斷優化確定< >的參數即分數。FM除了User ID和Item ID這兩類特徵外,還加入了二階特徵交叉特徵,可以看作是MF模型的進一步拓展。它將所有這些特徵轉化為embedding低維向量表達,並計算任意兩個特徵embedding的內積,就是特徵組合的權重,如果FM只使用User ID 和Item ID,則等價於MF. #### 從MF到FM模型 [[src]](https://blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/88265583) - MF 基本原理 - ![](https://i.imgur.com/ow1I4EO.jpg =400x) - ![](https://i.imgur.com/4QDptRF.jpg =400x) - (Matrix Factorization,矩陣分解)MF是個在推薦系統領域裡的協同過濾模型。 - 通過兩個低維小矩陣(一個 user embedding,一個 item embedding)的乘積,來模擬真實用戶點擊或評分產生的大的協同信息稀疏矩陣,本質上是編碼了用戶和物品協同信息的==降維模型==。 - 訓練完成,每個用戶和物品得到對應的低維 embedding 後,如果要預測某個「對的評分」的時候,只要它們做個「內積計算的得分就是預測得分」。看到這裡,讓你想起了什麼嗎? - MF & FM - ![](https://i.imgur.com/keEEaOZ.jpg =300x) - MF模型是FM模型的特例,MF可以被認為是只有User ID 和Item ID這兩個特徵的 FM 模型,MF 將這兩類特徵通過矩陣分解,來達到將這兩類特徵 embedding 化表達的目的。 - FM則可以看作是MF模型的進一步拓展,除了User ID和Item ID這兩類特徵外,很多其它類型的特徵,都可以進一步融入FM模型裡,它將所有這些特徵轉化為embedding低維向量表達,並計算任意兩個特徵embedding的內積,就是特徵組合的權重,如果FM只使用User ID 和Item ID,你套到FM公式裡,看看它的預測過程和MF的預測過程一樣嗎? - 從誰更早使用特徵embedding表達這個角度來看的話,很明顯,和FM比起來,MF才是真正的前輩,無非是特徵類型比較少而已。而FM繼承了MF的特徵embedding化表達這個優點,同時引入了更多Side information作為特徵,將更多特徵及Side information embedding化融入FM模型中。所以很明顯FM模型更靈活,能適應更多場合的應用范圍。 - 其一:在你有使用MF做協同過濾的想法的時候,暫時壓抑一下這種沖動,可以優先考慮引入FM來做的,而非傳統的MF,因為可以在實現等價功能的基礎上,很方便地融入其它任意你想加入的特徵,把手頭的事情做得更豐富多彩。 - 其二:從實際大規模數據場景下的應用來講,在排序階段,絕大多數只使用ID信息的模型是不實用的,沒有引入Side Information,也就是除了User ID/Item ID外的很多其它可用特徵的模型,是不具備實戰價值的。原因很簡單,大多數真實應用場景中,User/Item有很多信息可用,而協同數據只是其中的一種,引入更多特徵明顯對於更精準地進行個性化推薦是非常有幫助的。而如果模型不支持更多特徵的便捷引入,明顯受限嚴重,很難真正實用,這也是為何矩陣分解類的方法很少看到在Ranking階段使用,通常是作為一路召回形式存在的原因。 - ....... 剩下的去原網站讀好了 --- ### [FM] #### Factorization Machines — 稀疏資料的救星 [[src]](https://medium.com/@jimmywu0621/factorization-machines-%E7%A8%80%E7%96%8F%E8%B3%87%E6%96%99%E7%9A%84%E6%95%91%E6%98%9F-732153700d10) - 論文: https://www.csie.ntu.edu.tw/~b97053/paper/Rendle2010FM.pdf - 這篇講的是 FM 啊,不是 DeepFM! - 但是它提到了我們的困難 - preview : - ![](https://i.imgur.com/r4pQICy.jpg =300x) - ![](https://i.imgur.com/7lquNFt.png =300x) - ![](https://i.imgur.com/mrrhVsy.png =300x) --- ### [DeepFM] #### 輕讀論文(二):DeepFM: A Factorization-Machine based Neural Network for CTR Prediction [[src]](https://lufor129.medium.com/%E8%BC%95%E8%AE%80%E8%AB%96%E6%96%87-%E4%BA%8C-deepfm-a-factorization-machine-based-neural-network-for-ctr-prediction-9de74b8772ab) - 論文: https://arxiv.org/pdf/1703.04247.pdf - DeepFM 是由Wide & Deep這篇論文延伸出來的,因此這次會先介紹Wide & Deep。這篇主要目的是利用深度學習優化推薦系統。 - preview - ![](https://i.imgur.com/X7xSzf0.jpg =300x) #### [d2l .ai] 17.10. Deep Factorization Machines(文後有 DeepFM 範例程式碼) [[src]](https://d2l.ai/chapter_recommender-systems/deepfm.html) - Learning effective feature combinations is critical to the success of click-through rate prediction task. Factorization machines model feature interactions in a linear paradigm (e.g., bilinear interactions). This is often insufficient for real-world data where inherent feature crossing structures are usually very complex and nonlinear. What’s worse, second-order feature interactions are generally used in factorization machines in practice. Modeling higher degrees of feature combinations with factorization machines is possible theoretically but it is usually not adopted due to numerical instability and high computational complexity. > 學習有效的特徵組合對於點擊率預測任務的成功至關重要。分解機器以線性範式(例如,雙線性交互)對特徵交互進行建模。對於固有特徵交叉結構通常非常複雜和非線性的實際數據,這通常是不夠的。更糟糕的是,二階特徵交互在實踐中通常用於分解機器。用分解機對更高程度的特徵組合進行建模在理論上是可能的,但由於數值不穩定性和高計算複雜性,通常不採用這種方法。 - One effective solution is using deep neural networks. Deep neural networks are powerful in feature representation learning and have the potential to learn sophisticated feature interactions. As such, it is natural to integrate deep neural networks to factorization machines. Adding nonlinear transformation layers to factorization machines gives it the capability to model both low-order feature combinations and high-order feature combinations. Moreover, non-linear inherent structures from inputs can also be captured with deep neural networks. In this section, we will introduce a representative model named deep factorization machines (DeepFM) (Guo et al., 2017) which combine FM and deep neural networks. > 一種有效的解決方案是使用深度神經網絡。深度神經網絡在特徵表示學習方面非常強大,並且有可能學習複雜的特徵交互。因此,將深度神經網絡集成到分解機器是很自然的。向分解機器添加非線性變換層使其能夠對低階特徵組合和高階特徵組合進行建模。此外,來自輸入的非線性固有結構也可以用深度神經網絡捕獲。在本節中,我們將介紹一個具有代表性的模型,稱為深度分解機 (DeepFM) (Guo et al., 2017),它結合了 FM 和深度神經網絡。 - DeepFM consists of an FM component and a deep component which are integrated in a parallel structure. The FM component is the same as the 2-way factorization machines which is used to model the low-order feature interactions. The deep component is an MLP that is used to capture high-order feature interactions and nonlinearities. These two components share the same inputs/embeddings and their outputs are summed up as the final prediction. It is worth pointing out that the spirit of DeepFM resembles that of the Wide & Deep architecture which can capture both memorization and generalization. The advantages of DeepFM over the Wide & Deep model is that it reduces the effort of hand-crafted feature engineering by identifying feature combinations automatically. > DeepFM 由一個 FM 組件和一個 deep 組件組成,它們集成在一個並行結構中。 FM 組件與用於對低階特徵交互進行建模的 2 路分解機相同。深度組件是一個 MLP,用於捕獲高階特徵交互和非線性。這兩個組件共享相同的輸入/嵌入,它們的輸出總結為最終預測。值得指出的是,DeepFM 的精神類似於 Wide & Deep 架構的精神,既能記憶又能泛化。 DeepFM 相對於 Wide & Deep 模型的優勢在於它通過自動識別特徵組合來減少手工特徵工程的工作量。 - We omit the description of the FM component for brevity and denote the output as $\hat{y}^{(FM)}$. Readers are referred to the last section for more details. Let $e_{i} ∈ ℝ^{k}$ denote the latent feature vector of the $i^{th}$ field. The input of the deep component is the concatenation of the dense embeddings of all fields that are looked up with the sparse categorical feature input, denoted as: > 為簡潔起見,我們省略了 FM 組件的描述,並將輸出表示為 $\hat{y}^{(FM)}$ 。讀者可參考最後一節了解更多詳情。讓 $e_{i} ∈ ℝ^{k}$ 表示潛在特徵向量 $i^{th}$ 個field。深度組件的輸入是使用稀疏分類特徵輸入查找的所有 fields 的密集嵌入的串聯 - Colab 範例: deepfm.ipynb - https://colab.research.google.com/github/d2l-ai/d2l-en-colab/blob/master/chapter_recommender-systems/deepfm.ipynb#scrollTo=7a441bf7 #### 【推荐算法实战】DeepFM模型(tensorflow2.0版)[[src]](https://bbs.huaweicloud.com/blogs/343721) --- ### [online 推薦] #### Facebook 如何給你下廣告 [[src]](https://medium.com/@jimmywu0621/facebook-%E5%A6%82%E4%BD%95%E7%B5%A6%E4%BD%A0%E4%B8%8B%E5%BB%A3%E5%91%8A-5b440c601213) - 雖然這個沒有明顯跟 FM / DeepFM 扯上關係, - 但本篇重點 Online Recommendation System ,也許我們的姿勢雲的推薦要從 offline 轉 online 推薦的過程中,這個圖讓我們可以進入正確的思考途徑 - ![](https://i.imgur.com/mRFcEEn.png =300x)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully