David Ho
    • 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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Titanic [TOC] ## Introduction 這是一個在[Kaggle](https://www.kaggle.com/c/titanic/overview)上具有眾多挑戰者的一項挑戰,資料量不大,但很髒。主要為鐵達尼號搭乘者在撞擊冰山之後的生還資料。主辦方所提供的數據有三個: 1. train.csv 2. test.csv 3. gender_submissing.csv 參加者必須利用提供的數據,設計一個模型來預測乘客的生存與否。 ## Dataset 數據由三個CSV檔案組成,在`train.csv`、`test.csv`中分別有891筆以及418筆乘客資訊。`gender_submission.csv`檔案中包含了`test.csv`資料內的乘客生還狀況。 在資料集中,存在以下的資訊: | Variable | Definition | Remark | |:--------:|:------------------------------------------:|:--------------------------------:| | Survival | Survival | 0 = deceased, 1 = survived | | Pclass | Ticket class | 1 = First, 2 = Second, 3 = Third | | Sex | Sex | male, female | | Age | Age in years | float, contains decimal counts | | Sibsp | # of siblings / spouses aboard the Titanic | | | Parch | # of parents / children aboard the Titanic | Some children travelled only with a nanny, therefore parch=0 for them. | | Ticket | Ticket number | | | Fare | Passenger fare | float | | Cabin | Cabin number | | | Embarked | Port of Embarkation | {Port}\s{ID} | ## Data Mining and Analysis 在進行資料分析之前,我們可以先思考一下哪些可能會是提高生存率的因素: 1. 艙等:較高艙等的旅客,可能因服務以及設施較佳而獲得更高的存活率? 2. 性別:是否因為觀念以及道德緣由,而讓特定性別存活率較高?(i.e. 禮讓女性等) 3. 年齡:是否因為年齡的影響,而在逃生時具有較高之優先度或存活率?(壯年者較容易存活,或是小孩較受到保護) 4. 家庭人數:倖存者是否可能因身處在較多人/少人的逃生團體,進而提昇存活率?而團體內的成員組成是否又影響到團體的存活能力? 既然提出了假設,那我們可以透過分析數據來驗證我們的想法。 1. 艙等對於存活率之影響: ![](https://i.imgur.com/vFT6uAx.png) 從上圖可見,艙等對存活率是有影響的。 2. 性別對於存活率之影響: ![](https://i.imgur.com/KnnceOP.png) 從上圖可見,性別對存活率是有影響的。 3. 年齡對於存活率之影響: ![](https://i.imgur.com/s8EDm5i.png) 從上圖所得到的資訊,我們很難直接判斷大部份年齡對於存活率的影響程度。唯一能確定的是0-10歲的嬰兒具有較高之存活率,可能是因為逃難群眾認為應該優先保障幼兒的判斷所導致。 4. 家庭人數對存活率之影響: ![](https://i.imgur.com/M3vhKWq.png) 從上圖可以發現,無論是家庭人數太多(人數>5)或太少(人數<2)的家庭都具有較差的存活率。在人數為2-5人的家庭出現了存活率較高的跡象,這表明人數對存活率有一定的影響能力。或許可以解讀為「人太少時,難以生存;但人太多時反而阻礙逃生」? ## 模型建立 基於這項挑戰的目標是「預測乘客的生存與否」,我們在模型的選擇上將會以分類器為主要的目標。常見的分類器有SVM、K-NN、以及Random Forest等分類器。在這邊我們可以簡單的闡述各種分類器的實作以及所需要的預處理。 1. Support Vector Machine (SVM): SVM是可以用於進行分類以及擬合的,一個非常基礎的監督式學習演算法。輸入資料可以是一維或是多維的數組,每一筆資料必須要有相應的標記或是對應函數值來讓SVM進行分類或是擬合的處理。 SVM的原理是利用建構一個超平面的方法來將數據進行分類,分類方式可以是線性或是非線性的。假定有一個$p$維的數據,SVM可以在$(p-1)$維的空間中找出一個超平面來對整組數據進行分類。對於一些線性不可分等問題,SVM也可以利用Positive-definite kernel所建構的方法來進行處理。 在利用SVM時,基於其計算性質,輸入資料必須經過正規化等處理以避免模型預測受到資料範圍的影響。 > 延伸閱讀:https://scikit-learn.org/stable/modules/svm.html#svm 2. K-Nearest Neighbors Algorithm (K-NN): 3. Random Forest ###### tags: `技術隨筆` `數據分析實例` `Titanic`

    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