邵禹翔
    • 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
    # AI cup # Part1. Document retrieval ## 一種能讓Part1變高分的策略 我的想法是,若我們想論證一句話的真偽性,**通常只需從pages中的一兩句話就能得知真偽**, 假設有一篇pages可以驗證真偽,但那篇page很大篇,裡面有非常多句話 那麼就算這篇pages可以驗證真偽,對模型來說可能也會被當成不相似的文本,因為裡面有太多不相關的敘述。 因此我做了一件事,我將wiki_pages的每句話獨立拆出來,用來計算相似度 預測時只要找出前TOPK最相似的句子,並去查詢這些句子在哪篇pages,就預測該Pages。 這個策略用在**Bert模型、Universal Sentence Encoder模型 (USE)** 上,分數會有顯著提高。 ## 目前試過的策略 在這部分中,我目前已經嘗試過許多策略,暫時紀錄一下 1. **TF-IDF** (hw3做法,目前表現最好) 2. **Word2vec** (表現似乎不好,且不能使用GPU加速,處理時間可能會很久,暫時停滯) 3. **Doc2vec** (尚未測試,不能使用GPU加速) 4. 使用**Bert模型**進行預測 (很有潛力,但執行時間有點長,暫時停滯) 5. 使用**Sentence Bert模型**進行預測 (失敗,似乎沒有能很好處理中文的選擇) 6. **使用Universal Sentence Encoder (USE)** (結果似乎比TF-IDF好,但最後成績沒有進步...) ## Universal Sentence Encoder (USE) 範例程式碼 ```python= import tensorflow as tf import tensorflow_hub as hub # 處理的文本列表 text_list = ["這是第一個句子。", "這是第二個句子。", "這是第三個句子。", ...] # 分批處理文本的批次大小 batch_size = 16 # 初始化 USE 模型 use_model = hub.load("https://tfhub.dev/google/universal-sentence-encoder-multilingual-large/3") # 建立空的 TensorFlow 張量列表 embeddings_list = [] # 將文本分批並處理 for i in range(0, len(text_list), batch_size): batch_text = text_list[i:i+batch_size] # 將文本轉換為 TensorFlow 張量 text_tensor = tf.constant(batch_text) # 使用 USE 模型獲取向量表示 embeddings = use_model(text_tensor) # 將向量表示添加到列表中 embeddings_list.append(embeddings) # 將列表中的向量串接起來 concatenated_embeddings = tf.concat(embeddings_list, axis=0) print(concatenated_embeddings.shape) ``` ## 使用Bert模型進行pages預測 # Part2. Sentence retrieval 1. hyperparameter(batch size, epoch_number, learning rate(dynamic?), top_k, ) 2. change model(?) ## pair_with_wiki_sentences更改 (紹桓) 該函式有兩大任務: ### 1.將每個claim的相關句全部組起來 (沒修改這部分) 其實就是將我們針對該claim預測的所有Pages取出來,裡面的每一句就是該claim的相關句 因此我們的predict_page有2個,pages分別有10句跟15句的內容長度,那claim的相關句就會有25個。 (可以發現,這部分與我們part1的預測結果有關,predict_pages的結果就是用在這個地方。) (如果predict_pagesㄉㄜ預測結果很爛,那麼不重要的相關句就會變非常多。) ### 2.針對每一個相關句去標記label(positive 0:非證據句,negative 1:證據句) 由於我們有**public_train.jsonl**這個檔案,我們可以很清楚地知道**有哪些句子會是標記成證據句(1)**,而非證據句(0)其實就是那些在pages中的所有其他句子。 先看一下原本官方的寫法,會發現他是將每個evident_set所有證據句全部串起來後才對其標註1, :::success ![](https://hackmd.io/_uploads/B1DzCqkr2.png) ::: 但這對我來說很奇怪,因為**negative的部分是將每一句都分開標記成0**,而不是以page為主。 (**以我的理解,一個evident_set就對應一個page**)。 如果label1的部分是以page裡的所有證據句為一組,標記一次的話 那negative的部分應該也要以page裡的所有非證據句為一組,標記一次。 但negative不是,negative是每句都會標記一項label為0。 而且**我們到後面使用model預測我們找到的這些相關句有哪些為證據句**時, **都是每句分別丟進去model來預測為證據句(1)還是非證據句(0),** 因此我覺得positive的寫法很奇怪,也許改成與negative一樣,**每一句拆開來標記會更好。** 因此我後來將positive的部分更改了一下: :::success ![](https://hackmd.io/_uploads/Sy5REikHh.png) ::: 表現似乎有變好一些: ### 修改前 ![](https://hackmd.io/_uploads/S1YNNiyHn.png) ### 修改後 ![](https://hackmd.io/_uploads/HJabZikH3.png) # Part3. Claim verification > ### 振揚、上緣 # Ref [AI cup website](https://tbrain.trendmicro.com.tw/Competitions/Details/28) [AI cup github](https://github.com/IKMLab/NCKU-AICUP2023-baseline) [Introduction video](https://www.youtube.com/watch?v=U7rGLDzLDNY&list=PLsAZt_Wot_Bg1gt7KDX2wHH0sgLkimDMr&index=13) ![](https://hackmd.io/_uploads/HkHHl7UE2.png)

    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