Trương Thành
    • 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

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

    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.
    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
    # Neighborhood Collaborative Filtering (NCF) Trong cách tiếp cận này thì ta gọi ma trận U (utility matrix) là ma trận gồm n hàng và m cột. Trong đó n là số lượng user và m là số lượng item. Mỗi ô trên ma trận sẽ là giá trị rating của user giành do item tương ứng. Đối với trường hợp user chưa đánh giá item thì giá trị sẽ là không (tương ứng với việc chưa được đánh giá). Phương án NCF bao gồm 2 phương án chính: - User based: Phương án này sẽ dựa trên sự tương đồng trong rating giữa các user để đưa ra dự đoán. Cụ thể để lấy các item gợi ý cho 1 user i nào đó thì chúng ta sẽ dựa vào các user khác tương đồng với user i và sử dụng đánh giá của những người này để lựa chọn những gợi ý cho user i. - Item based: Phương án này sẽ dựa trên sự tương đồng trong rating đối với các item để đưa ra dự đoán. Nó cũng gần giống với phương án sử dụng user based, chỉ khác là ở đây chúng ta sẽ xét sự tương đồng cho các item. Ở đây dù tiếp cận theo cách nào thì về mặt cơ bản, cách cài đặt 2 phương pháp này vẫn sẽ là như nhau nên ở đây sẽ chỉ trình bày cho phương án User based. Đầu tiên mỗi hàng của ma trận $U$ sẽ là một vector biểu diễn cho mỗi user $u_i$. Khi đó ta thấy rằng, để tìm các user khác tương đồng với user $i$ nào đó thì ta chỉ cần dựa trên việc so sánh vector với một số thang đó cụ thể. Ở đây ta có khá nhiều các phương án khác nhau, có thể kể đến: cosin, khoảng cách Euler, hệ số tương quan... Ở trong đồ án này thì vì lý do thời gian nên sẽ sử dụng khoảng cách cosin. Ta gọi $sim(i, j)$ là mức độ tương đồng giữa user $i$ và user $j$, khi đó ta có: $$sim(i, j) = \frac {u_i * u_j} {||u_i|| ||u_j||}$$ Thực tế thì ta sẽ có biểu thức trên tương đương với việc tính hệ số tương quan cho các vector $u_i$ đã được chuẩn hoá, ta sẽ nói thêm về phần này ở sau đó. Ở đây ta sẽ luôn có $-1 \leq sim(i, j) \leq 1$. - Ở đây $sim(i, j)$ càng gần 1 thì giữa 2 user $i$ và $j$ có quan hệ tương hỗ, tức là những bộ phim mà user $i$ có xu hướng thích thì user $j$ cũng có xu hướng thích bộ phim đó (dựa trên rating). - Trường hợp $sim(i, j)$ càng gần -1 thì giữa user $i$ và user $j$ có quan hệ đối kháng, nghĩa là những bộ phim mà user $i$ đánh giá cao thì user $j$ lại có xu hướng không thích các bộ phim này. - Trường hợp khi $sim(i, j) \sim 0$ thì giữa user $i$ và user $j$ sẽ có rất ít sự liên hệ. Khi đã tính được $sim(i, j)$ thì để tìm được các user có độ tương đồng cao nhất với 1 user $i$ cho trước, ta sẽ sắp xếp các giá trị này theo giá trị tăng dần trị tuyệt đối của $|sim(i, j)|$. Lúc này ta sẽ có nhiều phương án để chọn ra danh sách các user tương đồng với user $i$: - Ta sẽ chọn top $k$ user có độ tương đồng cao nhất, việc thay đổi $k$ sẽ phần nào đó ảnh hưởng đến mô hình. - Ta sẽ cho một mức tương đồng tối thiểu và chọn hết những user $j$ có mức độ tương đồng cao hơn mức này, tất nhiên, điều này trong thực tế sẽ có trường hợp mức này chọn quá cao và dẫn tới không có bất kỳ user nào nằm trong danh sách, hoặc mức này được sắp xếp quá thấp khiến cho danh sách này chứa gần như toàn bộ user. Sau khi đã có mức độ tương đồng và danh sách các user tương đồng, gọi $score(i, j)$ là rating dự đoán của user $i$ dành cho item $j$, ta có thể dự đoán rating của user $i$ cho một item $j$ nào đó như sau: $$score(i, j) = \bar{r_i} + \frac {\sum_{k} sim(i, k) (r_{kj} - \bar{r_k})} {\sum_{k} |sim(i, j)|}$$ Trong đó: - $\bar{r_i}$ là giá trị rating trung bình của user $i$. - $r_{kj}$ là đánh giá của user $k$ giành cho item $j$. Ở đây ta sẽ tách phần rating trung bình của user ra riêng bởi vì các user khác nhau thì có mức độ đánh giá khác nhau. Một số user họ dễ tính thì rating của họ sẽ thường cho cao. Với một số user khác đòi hỏi khắt khe hơn thì sẽ yêu cầu nhiều yếu tố để đánh giá một bộ phim, do đó phần đánh giá của họ sẽ có phần khác biệt. Để hạn chế những điều này thì ta sẽ đưa toàn bộ đánh giá về cùng một thang đó, như vậy ta sẽ giảm mức độ ảnh hưởng của điều này. Một vấn đề khác nảy sinh đó là giá trị $score(i, j)$ sẽ có thể nằm ngoài thang đo hiện có, chẳng hạn nếu ta có đánh giá từ 1-5 thì $score(i, j)$ hoàn toàn có thể bé hơn 1 hoặc lớn hơn 5. Trong những trường hợp này thì ta sẽ chỉ cần làm tròn $score(i, j)$ về giá trị gần nhất với nó nằm trong khoảng đánh giá 1-5. Ở đây thông thường để hệ thống hoạt động hiệu quả với một lượng truy cập lớn thì ta sẽ tính sẵn hệ số tương quan giữa từng cặp $(i, j)$. Và giữ các giá trị này trong 1 khoảng thời gian, (điều này nghĩa là khi user $i$ có 1 lượt đánh giá mới cho một item nào đó thì ta sẽ không cập nhật lại ngay việc này), chẳng hạn 1 tuần hay hơn, vì nhìn chung số lượng rating của user đánh giá là không quá nhiều, ngoài ra nếu chỉ mỗi user có thêm vài lượt đánh giá thì nhìn chung dự đoán rating sẽ không thay đổi quá nhiều. Tuy nhiên ở đây chúng ta sẽ gặp phải 1 vấn đề tương đối lớn, đó là khi số lượng user quá nhiều thì sẽ có đến $O(n^2)$ cặp $(i, j)$ cần phải tính, tuy nhiên ta cũng sẽ nhận ra rằng việc tính hết các cặp này trong thực tế lại không quá cần thiết vì chúng ta sẽ chỉ sử dụng 1 lượng nhỏ các user tương đồng để dự đoán mà thôi. Khi đó ta sẽ có ý tưởng đó là chia các user đã cho thành các cụm, và việc tìm các user tương đồng thay vì tìm trên toàn bộ các user thì lúc này ta sẽ chỉ cần tìm trong cụm. Hiệu quả của việc này sẽ phụ thuộc nhiều vào quá sự phân bố của cụm, các user phân bố càng đều vào cụm thì quá trình tính toán sẽ càng nhanh và ngược lại. Một vấn đề nữa của phương pháp tiếp cận kiểu NCF đó là chúng ta sẽ cần phải lưu 1 ma trận có kích thước lớn tuy nhiên phần lớn các giá trị trong ma trận lại nhận giá trị 0. Do đó khi số lượng user nhân với số lượng item lớn thì lượng bộ nhớ sử dụng cho phương pháp này sẽ rất lớn. Trong đồ án này, vì giới hạn bộ nhớ và tốc độ tính toán của Colab nên dataset sử dụng sẽ chỉ là dataset movie lens 100k. Để giảm lượng bộ nhớ cần dùng thì ta có thể sử dụng phương pháp Matrix Factorization, tuy nhiên do thời gian có hạn nên phương pháp này sẽ xem như là một hướng mở.

    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

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    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